labring / labring/laf

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

Open
#1,835 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
TypeScript
Stars
7.6k
Forks
670
PR merge metrics
No merged PRs in 30d

Description

### Search before asking

- [X] I had searched in the [issues](https://github.com/labring/laf/issues?q=is%3Aissue) 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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.