-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lsa command #96
base: master
Are you sure you want to change the base?
Add lsa command #96
Conversation
Hi how are you doing, just wanted to see all existing secret path of a vault. So just added it to your nice vsh. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi :)
Sorry for my late response - has been some busy days lately.
Thanks a lot for the PR!! 🙇
I've made some comments. Further:
- tests are missing
- Codeclimate found some issues: https://codeclimate.com/github/fishi0x01/vsh/pull/96
I can also have a look at that if you want.
client/list.go
Outdated
@@ -35,3 +46,29 @@ func (client *Client) listLowLevel(path string) (result []string, err error) { | |||
|
|||
return result, err | |||
} | |||
|
|||
func (client *Client) listAllLowLevel(path string, subResult* []string) (result[]string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the traverse
function do the same? https://github.com/fishi0x01/vsh/blob/master/client/traverse.go#L16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes kind of will look into how to use this function for the list all command then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't reinvent the wheel here.
cli/lsall.go
Outdated
return nil | ||
} | ||
|
||
// Run executes 'ls' with given ListCommand's parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: ls
-> lsa
, ListCommand
-> ListAllCommand
} | ||
|
||
// List elements at the given absolutePath, using the given client | ||
func (client *Client) ListAll(absolutePath string) (result []string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move that to Run
function of lsall.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't work without changing the package structure.
The used functions as isTopLevelPath
, topLevelTraverse
and lowLevelTraverse
are not available in the
lsall.go cli
package. So without a package refactoring not really possible.
And the other command functions like List
, Delete
, ... are also defined here and not in there command Run
function.
This commands list all child paths from a given parent path. Be careful to run from the root vault path. Can result in out of memory depends on the size of the vault.
Instead of returning ``` secret/environment/dev/petshop secret/environment/dev secret/environment ``` it return's only the full path. ``` secret/environment/dev/petshop ```
c8a2b51
to
df65bf5
Compare
This commands list all child paths from a given parent path.
Be careful to run from the root vault path. Can result in out
of memory depends on the size of the vault.