openfaas / faas-cli

Official CLI for OpenFaaS
https://www.openfaas.com/
Other
794 stars 226 forks source link

"faas-cli new" should accept option to use default stack.yml name #371

Open alexellis opened 6 years ago

alexellis commented 6 years ago

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?

s8sg commented 6 years ago

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

ericstoekl commented 6 years ago

I like --stack to perform the functionality of:

I would then vote to remove --append. I think there is no need for --override here.

alexellis commented 6 years ago

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?

s8sg commented 6 years ago

@alexellis Sure I'm on it

ivanayov commented 5 years ago

What's the status of this issue? I can see the PR closed.

martindekov commented 5 years ago

Should we be closing this? I saw Swarvanu and Eric both worked on this issue but both PRs got closed, does this mean the Issue is obsolete?