faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

Remove multiple functions with `faas-cli remove` by name

Open ema-pe opened this issue 3 months ago • 2 comments

It is not entirely clear whether multiple functions can be removed with a single faas-cli remove invocation. Suppose I have the following functions:

$ faas-cli version
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  619282afd0dd2520a7669ec9396282ce2348a35f
 version: 0.17.7

Gateway
 uri:     http://[...]
 version: 0.27.12
 sha:     4e20249bc0703954244d4be98eaa6c2bcb68cb83


Provider
 name:          faas-netes-ce
 orchestration: kubernetes
 version:       0.18.16 
 sha:           cac64e04f91db67b75d055d3ee4d286b303575db
Your faas-cli version (0.17.7) may be out of date. Version: 0.17.8 is now available on GitHub.
$ faas-cli list
Function                        Invocations     Replicas
figlet                          103819          1    
ocr                             8               1    
shasum                          825             1 

Then I run the following command:

$ faas-cli remove figlet shasum ocr
Deleting: figlet.
Removing old function.

After some seconds, this is the result:

$ faas-cli list
Function                        Invocations     Replicas
ocr                             8               1    
shasum                          825             1  

When I run faas-cli remove --help, the help message says that it is possible to remove multiple functions, but only if they are specified via a YAML config. If I specify functions by name, I can remove only one function at a time. I think it would be both easy and useful to add support for removing multiple functions in the latter mode.

ema-pe avatar Sep 24 '25 13:09 ema-pe

Multiple functions can be removed using the yaml. Arg parsing only supports single functions.

I feel like this has come up previously and the conversation would have been around using list and xargs

rgee0 avatar Sep 24 '25 16:09 rgee0

Multiple functions can be removed using the yaml. Arg parsing only supports single functions.

I feel like this has come up previously and the conversation would have been around using list and xargs

Okay, it's fine if it's intentional. It may be informative for users (like me the first time I used this command) to show a warning or error when they try to remove multiple functions by name.

ema-pe avatar Sep 24 '25 17:09 ema-pe