"faas-cli new" should accept option to use default stack.yml name
When typing in faas-cli new --lang node html-project for instance you get a YAML file named html-project.
We introduced "stack.yml" as a default file-name, but have no way of generating a new function with the stack name of stack.yml. You have to rename it afterwards.
What ideas do you have for allowing this without getting to verbose in the CLI?
faas new --lang python tester --stack=stack.yml
We do have an append flag - perhaps we could look at collapsing the --stack and --append flag into one option?
with introduction of: --stack, the <function_name>.yml can be default otherwise it will pick file name provided by the --stack
one point to think when combined --stack and --append is: in case user wants to create a fresh stack.yml file rather than appending to the existing one. We can have append as a default behaviour considering that file already exists, but what if user wants to override ?
Option 1:
We can have --override as a flag, to replace the stack.yml in case it exists. And completely remove the --append, as its the default behaviour
example:
faas-cli new text-reader --lang python --stack /myawesomenewfunc/stack.yml --override
Option 2:
One other way is to have --append as a flag. It its not provided and the stack file already exists, by default it will fail saying:
$ faas-cli new text-reader --lang python --stack /myawesomenewfunc/stack.yml
error: file <filename>.yml already exists
use --append to append to existing YAML file
use --force to replace the existing YAML file
Here --force flag can be used to replace the existing stack file
I personally prefer the Option 1
I like --stack to perform the functionality of:
- create your function in a new
stack.ymlif the file does not exist in your current directory - append the function definition to
stack.ymlif it exists
I would then vote to remove --append. I think there is no need for --override here.
I like the idea where ‘—stack’ performs both functions with the functions appended if the target file already exists. @s8sg do you want to go ahead and work on this?
@alexellis Sure I'm on it
What's the status of this issue? I can see the PR closed.