Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

fr123k
Copy link

@fr123k fr123k commented Apr 22, 2021

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.

@fr123k
Copy link
Author

fr123k commented Apr 22, 2021

Hi how are you doing,

just wanted to see all existing secret path of a vault. So just added it to your nice vsh.

@vikin91 vikin91 mentioned this pull request Apr 22, 2021
Copy link
Owner

@fishi0x01 fishi0x01 left a 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:

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) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@fr123k fr123k May 5, 2021

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.

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
Copy link
Owner

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) {
Copy link
Owner

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.

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.

@fishi0x01 fishi0x01 self-assigned this May 2, 2021
@fishi0x01 fishi0x01 added the enhancement New feature or request label May 2, 2021
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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants