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

Better flags #10

Open
greenled opened this issue May 11, 2019 · 8 comments
Open

Better flags #10

greenled opened this issue May 11, 2019 · 8 comments
Labels
enhancement New feature or request
Milestone

Comments

@greenled
Copy link
Owner

Flags should have a complete and a short form, something like --action and -a. This would help using and particularly reading them. A command like this one:

./psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g /path/to/env_vars_file

could also look like this one:

./psu --action deploy --user admin --password password --instance http://portainer.local --stack mystack --compose-file /path/to/docker-compose.yml --env-file /path/to/env_vars_file
@tortuetorche
Copy link
Collaborator

tortuetorche commented May 28, 2019

Hi @greenled,

I've done some work on this issue, I'm going to share some code with you soon.
I think the action option should be an argument instead, like this:

psu deploy --user admin --password password --instance http://portainer.local --stack mystack --compose-file /path/to/docker-compose.yml --env-file /path/to/env_vars_file

Any thoughts/comments on this?

Have a good day,
Tortue Torche

@greenled
Copy link
Owner Author

Hi @tortuetorche. I'm glad to hear you are working on something new!
I agree the action should be an argument, but we should be careful with this change, as it would change the API in a way that could break some pipelines out there ;) I am setting some ground for these breaking changes (and more to come), see #9.

@greenled
Copy link
Owner Author

@tortuetorche see #12 for your action as an argument idea.

@tortuetorche
Copy link
Collaborator

tortuetorche commented May 29, 2019

Hi @greenled,

but we should be careful with this change, as it would change the API in a way that could break some pipelines out there ;)

I'm totally agree with you, I think we can have both, <action> as an argument and -a|--action as a deprecated option to keep backward compatibility.

@tortuetorche
Copy link
Collaborator

FYI, I just publish some work on my next branch of psu.
It's an alpha version, there is a lot of things to do and debug...

@tortuetorche
Copy link
Collaborator

tortuetorche commented May 29, 2019

Here the output of the psu help command, who list the flags and options:

Portainer Stack Utils, version 0.2.0-alpha.2

  Usage:
    psu <action> [options]

  Arguments:
    action                         The name of the action to execute (possible values: 'deploy', 'undeploy', 'list', 'info', 'services', 'tasks', 'tasks_healthy', 'containers', 'status', 'help', 'version')

  Options:
    -u, --user=USERNAME            Username
    -p, --password=PASSWORD        Password
    -l, --url=URL                  URL to Portainer
    -n, --name=STACK_NAME          Stack name
    -c, --compose-file=[FILE_PATH] Path to docker-compose file (required if action=deploy)
    -g, --env-file                 Path to file with environment variables to be used by the stack (only used when action=deploy or action=update)
    -e, --endpoint=[ENDPOINT_ID]   Which Docker endpoint to use. Defaults to 1
    -r, --prune                    Whether to prune unused containers or not. Defaults to false
    -T, --timeout=[NUMBER_SECONDS] Status timeout, number of seconds before thrown an error (only used when action=status). Defaults to 100
    -j, --detect-job=[true|false]  Auto detect services who are jobs. Defaults to true
    -S, --service[=SERVICE_NAME]   Service name
    -i, --insecure                 Skip the host's SSL certificate verification. Defaults to false
    -v, --verbose                  Increase the verbosity of messages. Defaults to false
    -d, --debug                    Print as much information as possible to help diagnosing a malfunction. Defaults to false
    -q, --quiet                    Display the minimum of information or nothing, UNIX/Linux friendly. Defaults to false
    -t, --strict                   Never updates an existent stack nor removes an unexistent one, and instead exits with an error. Defaults to false
    -h, --help                     Display this help message
    -V, --version                  Display the version of this program
    -s, --secure[=yes|no]          DEPRECATED: Use the --insecure option instead. Enable or disable the host's SSL certificate verification. Defaults to 'yes'
    -a, --action=[ACTION_NAME]     DEPRECATED: Use <action> argument instead. The name of the action to execute

  Help:
    You can deploy/update/undeploy/list... stacks in a Portainer instance easily with this tool!

What do you think about the name of these options?
I think it's 100% backward compatible with psu 0.1.0

@greenled
Copy link
Owner Author

They look good to me. And yes, so far it looks 100% backwards compatible. Nice job! I see you also changed the --secure flag to a --insecure flag without arguments, which is more intuitive.

@greenled greenled added the enhancement New feature or request label May 31, 2019
@greenled greenled added this to the 1.0 milestone Aug 16, 2019
@greenled
Copy link
Owner Author

This isue is being worked on in the several-changes branch. Should be closed once that branch is merged.

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

No branches or pull requests

2 participants