fortify / fcli

fcli is a command-line utility for interacting with various Fortify products
https://fortify.github.io/fcli/
Other
31 stars 17 forks source link

cfg proxy settings delete-all #334

Closed xakrurychle closed 1 year ago

xakrurychle commented 1 year ago

./fcli cfg proxy and tabbed to display options... add clear delete delete-all list ls rm update

./fcli cfg proxy delete-all Unmatched argument at index 2: 'delete-all'

vs

./fcli cfg proxy -h Manage fcli proxy configurations.

Usage: fcli config proxy [[-h] [--env-prefix=] [--log-file=] [--log-level=]] [COMMAND]

Commands for managing connectivity through proxies

Command options: Generic fcli options: -h, --help Show this help message and exit. Use 'fcli -h' to display help for subcommands. --env-prefix= Environment variable prefix for resolving default option and parameter values. Default value is FCLI_DEFAULT. --log-file= File where logging data will be written. If not specified, no logging data will be written. --log-level= Set logging level. Note that DEBUG and TRACE levels may result in sensitive data being written to the log file. Allowed values: TRACE, DEBUG, INFO, WARN, ERROR. Commands: add Add a proxy configuration. clear Clear all proxy configurations. delete, rm Delete a proxy configuration. list, ls List proxy configurations. update Update a proxy configuration.

Please refer to https://fortify.github.io/fcli for general fcli usage information.

Seems like delete-all is either missing as command / should not be offered when tabbing for options.

fcli version 0.20230629.082654-dev_develop, built on 2023-06-29 08:27:42

rsenden commented 1 year ago

@xakrurychle Can you please double-check that you've used the correct auto-complete script? I think 2.0.0-beta may still have both delete-all and clear aliases for the same command, whereas the delete-all alias was removed in develop.

xakrurychle commented 1 year ago

./fcli cfg proxy add clear delete list ls rm update

OK it works now once I sourced the fcli_autocomplete again. How it led to this error on my side - I have in my .bashrc

export PATH=$PATH:~/fcli-demo/fcli_v3/
source /home/qaprague/fcli-demo/fcli_v3/fcli_completion

export PATH=$PATH:~/fcli-demo/fcli_v2/
source /home/qaprague/fcli-demo/fcli_v2/fcli_completion

so obviously it used the one from fcli_v2. Any idea how to set it so that v2 would use v2 completion and v3 its v3 completion script? v2 is my alias for beta while v3 is the develop just to clarify

PS: if I run fcli -V from home directory,with both fcli versions exported in .bashrc, it automatically uses fcli develop version

$ fcli -V
fcli version 0.20230629.082654-dev_develop, built on 2023-06-29 08:27:42

so another question would be why was there a mismatch for the completion script? Granted, its nothing serious, I just would like to maybe understand better.

rsenden commented 1 year ago

The completion script is generated to match for a particular fcli version, so it's the user's responsibility to make sure that the completion script that they're sourcing matches the fcli version being used. In practice, users will likely only have a single fcli version installed, so this usually shouldn't cause issues like these.

In your example, the last completion script sourced is from your fcli_v2 directory, however the first entry on the path is the fcli_v3 directory (as fcli_v2 is appended to the end of the PATH, after fcli_v3 has already been added earlier). So, effectively this means that your using the fcli_v2 completion script with the fcli_v3 fcli executable.

Based on this issue, I'm adding a note to the documentation as shown below. There's not much else that we can do about this, as this is basically an environment misconfiguration.

image