laf icon indicating copy to clipboard operation
laf copied to clipboard

[Feature] laf-cli support push/pull funcs in batch

Open aFlyBird0 opened this issue 1 year ago • 0 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Feature Request

English Version

Currently, laf-cli only supports pushing/pulling all cloud functions or a specific cloud function. However, sometimes we want to pull a set of cloud functions that meet certain conditions.

We can add an additional option -r (regex) or --prefix to enable this feature.

There are several design options:

  • Prefix matching. For example, laf func pull --prefix auth, will pull all functions starting with auth (e.g., auth/login, auth/register). This feature will be very useful when developing by module.
  • Regular expression. For example, laf func push -r user, will push all functions containing user (e.g., getUserInfo, updateUser).

The former is easier to use and closer to real-world use cases (pulling by module/folder). The latter is more powerful but more complex. (For example, we can also use laf func push -r "^user" to achieve the prefix matching effect.)

By the way, we can also introduce the --tags parameter to filter based on tags.

中文版本

目前laf-cli只能push/pull所有云函数或某个云函数,但我们有时希望拉取符合条件的一组云函数。

我们可以添加一个额外的选项 -r(regex) 或 --prefix 来开启这个特性。

有下面几种设计方案:

  • 前缀匹配。例如 laf func pull --prefix auth,将pull所有 auth 开头的函数,(例如 auth/login, auth/register)。当我们按模块开发的时候,这个功能将非常有用。
  • 正则。例如 laf func push -r user,将push所有包含user的函数,(例如 getUserInfo, updateUser)。

前者使用起来更简单,更贴近真实的需求场景(按模块/文件夹拉取) 后者更强大,但更复杂。(例如,我们也可以使用 laf func push -r "^user" 达到前缀匹配的效果)

顺便一提,我们还可以引入 --tags 参数,根据标签进行筛选。

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

aFlyBird0 avatar Feb 01 '24 09:02 aFlyBird0