diff --git a/README.md b/README.md index 5371954..fc500c8 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,13 @@ portainer-cli login douglas d1234 Create a stack. ```bash -portainer-cli create_stack -n stack_name -e endpoint_id -f stack_file +portainer-cli create_stack -n stack_name -e endpoint_id -sf stack_file ``` **E.g:** ```bash -portainer-cli create_stack -n stack_name -e 1 stack-test -f docker-compose.yml +portainer-cli create_stack -n stack_name -e 1 stack-test -sf docker-compose.yml ``` #### Flags @@ -67,27 +67,27 @@ portainer-cli create_stack -n stack_name -e 1 stack-test -f docker-compose.yml |--|--| | `-n` or `-stack-name` | Stack name | | `-e` or `-endpoint-id` | Endpoint id (required) | -| `-f` or `-stack-file` |Stack file | -| `-w` or `-env-file` | Pass env file path, usually `.env` | +| `-sf` or `-stack-file` |Stack file | +| `-ef` or `-env-file` | Pass env file path, usually `.env` | ### update_stack command Update a stack. ```bash -portainer-cli update_stack -s stack_id -e endpoint_id -f stack_file +portainer-cli update_stack -s stack_id -e endpoint_id -sf stack_file ``` **E.g:** ```bash -portainer-cli update_stack -s 18 -e 1 -f docker-compose.yml +portainer-cli update_stack -s 18 -e 1 -sf docker-compose.yml ``` #### Environment variables arguments ```bash -portainer-cli update_stack id -s stack_id -e endpoint_id -f stack_file --env.var=value +portainer-cli update_stack id -s stack_id -e endpoint_id -sf stack_file --env.var=value ``` Where `var` is the environment variable name and `value` is the environment variable value. @@ -98,8 +98,8 @@ Where `var` is the environment variable name and `value` is the environment vari |--|--| | `-s` or `-stack-id` | Stack id | | `-e` or `-endpoint-id` | Endpoint id (required) | -| `-f` or `-stack-file` |Stack file | -| `-w` or `-env-file` | Pass env file path, usually `.env` | +| `-sf` or `-stack-file` |Stack file | +| `-ef` or `-env-file` | Pass env file path, usually `.env` | | `-p` or `--prune` | Prune services | | `-c` or `--clear-env` | Clear all environment variables | @@ -108,19 +108,19 @@ Where `var` is the environment variable name and `value` is the environment vari Create or update a stack based on it's name. ```bash -portainer-cli create_or_update_stack -n stack_name -e endpoint_id -f stack_file +portainer-cli create_or_update_stack -n stack_name -e endpoint_id -sf stack_file ``` **E.g:** ```bash -portainer-cli update_stack -s 18 -e 1 -f docker-compose.yml +portainer-cli update_stack -s 18 -e 1 -sf docker-compose.yml ``` #### Environment variables arguments ```bash -portainer-cli create_or_update_stack -n stack_name -e endpoint_id -f stack_file --env.var=value +portainer-cli create_or_update_stack -n stack_name -e endpoint_id -sf stack_file --env.var=value ``` Where `var` is the environment variable name and `value` is the environment variable value. @@ -131,8 +131,8 @@ Where `var` is the environment variable name and `value` is the environment vari |--|--| | `-n` or `-stack-name` | Stack name | | `-e` or `-endpoint-id` | Endpoint id (required) | -| `-f` or `-stack-file` |Stack file | -| `-w` or `-env-file` | Pass env file path, usually `.env` | +| `-sf` or `-stack-file` |Stack file | +| `-ef` or `-env-file` | Pass env file path, usually `.env` | | `-p` or `--prune` | Prune services | | `-c` or `--clear-env` | Clear all environment variables | diff --git a/portainer_cli/__init__.py b/portainer_cli/__init__.py index cb04902..92c6a60 100755 --- a/portainer_cli/__init__.py +++ b/portainer_cli/__init__.py @@ -273,8 +273,8 @@ class PortainerCLI(object): @plac.annotations( stack_name=('Stack name', 'option', 'n', str), endpoint_id=('Endpoint id', 'option', 'e', int), - stack_file=('Stack file', 'option', 'f'), - env_file=('Environment Variable file', 'option', 'w'), + stack_file=('Stack file', 'option', 'sf'), + env_file=('Environment Variable file', 'option'), prune=('Prune services', 'flag', 'p'), clear_env=('Clear all env vars', 'flag', 'c'), ) @@ -289,10 +289,10 @@ class PortainerCLI(object): @plac.annotations( stack_name=('Stack name', 'option', 'n'), endpoint_id=('Endpoint id', 'option', 'e', int), - stack_file=('Environment Variable file', 'option', 'f') - env_file=('Environment Variable file', 'option', 'w') + stack_file=('Environment Variable file', 'option', 'sf'), + env_file=('Environment Variable file', 'option', 'ef') ) - def create_stack(self, stack_name, endpoint_id, stack_file, env_file='', *args): + def create_stack(self, stack_name, endpoint_id, stack_file='', env_file='', *args): logger.info('Creating stack name={}'.format(stack_name)) stack_url = 'stacks?type=1&method=string&endpointId={}'.format( endpoint_id @@ -392,8 +392,8 @@ class PortainerCLI(object): @plac.annotations( stack_id=('Stack id', 'option', 's', int), endpoint_id=('Endpoint id', 'option', 'e', int), - stack_file=('Stack file', 'option', 'f'), - env_file=('Environment Variable file', 'option', 'w'), + stack_file=('Stack file', 'option', 'sf'), + env_file=('Environment Variable file', 'option', 'ef'), prune=('Prune services', 'flag', 'p'), clear_env=('Clear all env vars', 'flag', 'c'), )