Comments (10)
Totally! Would you like to send a PR? :)
from zlocation.
I'll take a look at it tonight.
from zlocation.
I think you'll have to set a defaultdisplaypropertyset on the returned values.
It might be tricky because it's technically a single Hashtable value being returned, which I think is being enumerated as a bunch of DictionaryEntry
s. So they're controlling the rendering. You might need to replace the returned value with some sort of custom collection.
from zlocation.
Yup, I was initially trying to stick with the hashtable and give the "DictionaryEntry" objects a new type name in their typenames collection. But GetEnumerator()
generates new DictionaryEntry objects. :-(
from zlocation.
from zlocation.
Class syntax would limit this module to v5 and higher. I don't think that is ideal but it's up to @vors. Maybe we could return a PSCustomObject but maintain a module level, private variable that is the hashtable for quick lookup of the weight from the path (key). Also, to work better on Linux the hashtable/dictionary should be case-sensitive.
from zlocation.
from zlocation.
I opened #64 for the 5.0 question, I'm a little bit on the fence about it.
I think this works (
... .GetEnumerator() | Select-Object -Property Name, Value
from zlocation.
If we only intend to change the behavior of Invoke-Location
(and z
- alias to this function) that should work. Although it would need to be something like this:
if ($null -eq $match) {
Get-ZLocation |
ForEach-Object GetEnumerator |
Select-Object @{Name='Weight';Expression={$_.Value}},@{Name='Path';Expression={$_.Name}}
return
}
Outputs:
Weight Path
------ ----
3 C:\Users\Keith\GitHub\rkeithhill\ZLocation
1 C:\Users\Keith
6 C:\Users\Keith\GitHub\rkeithhill\ZLocation\ZLocation
Although that outputs a series of DictionaryEntry
objects with Weight/Path
properties tacked on. That feels a bit odd. The output of Invoke-Location
is not internally used so we could probably get away with changing the output from hashtable
to something else. I think a set of PSCustomObjects would probably be better. External users can still access the hashtable by calling Get-ZLocation
. Thoughts? If you agree in principle I submit a PR for this.
from zlocation.
OK, this is the [PSCustomObject]
version:
if ($null -eq $match) {
Get-ZLocation |
ForEach-Object {$_.GetEnumerator()} |
ForEach-Object {[PSCustomObject]@{Weight = $_.Value; Path = $_.Name}}
return
}
Now, need to figure out how far back [PSCustomObject]
goes. I think it goes back to v3. If so, we'd be good.
from zlocation.
Related Issues (20)
- Windows detection bug in Get-FrequentFolders HOT 2
- Error on new install of 1.4.1 HOT 2
- It would be great to see a list of most recent HOT 2
- [Feature Request] Allow installation via Chocolatey
- Set-ZLocation and Update-ZLocation break for PS 7 if the user has defined an alias for 'find' HOT 1
- How to exclude a directory from tracking? HOT 1
- Exception calling "Add" with "2" argument(s) - issue after updating powershell to 7.1 HOT 2
- [Feature Request] z partial/path/to/dir? HOT 1
- Doesn't work with posh-git's error reporting (DollarQuestion) HOT 3
- how can I unsinstall it?thanks. HOT 1
- Database has duplicate entries differing in case only
- Cannot z to network drives HOT 1
- Invoke-ZLocation doesn't work with oh-my-posh + posh-git + ZLocation HOT 2
- Question: possible to prefer child directories? HOT 1
- [Feature request] only display directories with tab completion HOT 5
- Duplicate Unc Paths in Database Where Only One Is Updated
- ZLocation not working as intended. HOT 6
- profile file flood
- Can't jump a folder with `[` or `]` in it
- Add option to customize db location HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zlocation.