You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `clean` command can be used to clean up the cache of Serverless Devs. You can use this command to clean up the environment, dependency packages that are not used, and the cache.
11
-
12
-
-[Command-description](#Command-description)
13
-
-[Parameter description](#Parameter-description)
14
-
-[Example](#Example)
15
-
-[Precautions](#Precautions)
16
-
17
-
## Command description
18
-
19
-
After you execute the `s clean -h` command, we can view the help information:
20
-
7
+
# Clean Command
8
+
The `s clean` command is designated to clear the cache and associated functionalities within Serverless Devs. With this command, you're able to cleanse the environment, eliminate unused dependencies, and remove relevant cached data.
9
+
-[Command Overview](#command-overview)
10
+
-[Parameters](#parameters)
11
+
-[Usage Examples](#usage-examples)
12
+
-[Cautions](#cautions)
13
+
## Command Overview
14
+
To access help information, execute `s clean -h`:
21
15
```shell script
22
16
$ s clean -h
23
-
Usage: s cli [options]
24
-
17
+
Usage: s clean [options]
25
18
Clean up the cache related functions of serverless devs. You can clean up the environment, unused dependent packages and related cache contents through this command.
The `cli` command allows you to directly use Serverless Devs components in CLI mode, instead of the YAML mode.
11
-
12
-
-[Command description](#Command-description)
13
-
-[Common modes](#Common-modes)
14
-
-[Support for common components](#Support-for-common-components)
15
-
-[Support for specific components](#Support-for-specific-components)
16
-
17
-
> For more information about the differences between the YAML mode and the CLI mode, see [Compare the YAML mode with the CLI mode](./../yaml_and_cli.md)
18
-
19
-
## Command description
20
-
21
-
After you run the `s cli -h` command, the following help information is returned:
22
-
7
+
# Cli Command
8
+
The `cli` command provides a command line interface within Yamlized, allowing direct use of Serverless Devs components via the CLI without the dependence on Yaml files.
> For insights into the differences between Yaml mode and Cli mode, as well as their respective use cases, please consult the [Yaml Mode vs. Cli Mode Comparison](./../yaml_and_cli.md) document.
14
+
## Command Breakdown
15
+
Executing `s cli -h` displays the relevant help information:
23
16
```shell script
24
17
$ s cli -h
25
-
Usage: s cli [component] [method] [options]
26
-
27
-
Directly use serverless devs to use components, develop and manage applications without yaml configuration.
18
+
Usage: s cli [options]
19
+
Utilize Serverless Devs components for application development and management without the need for yaml configuration.
20
+
21
+
Examples:
22
+
$ s cli fc api ListServices
23
+
$ s cli fc api ListFunctions --path '{"serviceName": "serviceName"}' --body '{"K1": "V1"}'
28
24
29
-
Example:
30
-
$ s cli fc-api listServices
31
-
$ s cli fc-api listFunctions --service-name my-service
32
-
$ s cli fc-api deploy -p "{/"function/": /"function-name/"}"
-a, --access [aliasName] Specify the access alias name
38
-
-p, --props [jsonString] The json string of props
39
-
-h, --help Display helpforcommand
27
+
-p, --props <jsonString> JSON string of props
28
+
-h, --help Display helpforcommand
40
29
```
41
-
42
-
Method:
43
-
30
+
Typical usage involves:
44
31
```shell script
45
-
s cli [The component name, such as fc or fc-api.] [The method of the component.] -p/--props [The YAML attribute (JSON string) of the method] -a/--access [The information about the specified key.] [Other settings]
32
+
s cli [component name, e.g., fc, fcapi, etc.] [component method] -p/--props [Yaml property equivalent for the method (JSON string)] -a/--access [specify key info] [additional settings]
46
33
```
47
-
48
-
49
-
## Common modes
50
-
51
-
### Support for common components
52
-
53
-
In `cli` mode, you can use the `-p, --props [jsonString]` parameter to configure general support for the component.
54
-
55
-
For example, you specify the following description in the `s.yaml` of a Serverless Devs application:
56
-
57
-
34
+
## Common Usage Patterns
35
+
### General Component Support
36
+
In Cli mode, you can support components by using the `-p, --props [jsonString]` parameter.
37
+
For instance, a Serverless Devs application might be described like so:
58
38
```yaml
59
-
edition: 1.0.0
39
+
edition: 3.0.0
60
40
access: "myaccess"
61
-
62
-
services:
41
+
resources:
63
42
website-starter:
64
43
component: devsapp/website
65
44
props:
@@ -72,29 +51,23 @@ services:
72
51
hosts:
73
52
- host: auto
74
53
```
75
-
76
-
You can also use `s website-starter deploy` to deploy `website-starter`.
77
-
78
-
In this case, if you deploy website-starter in `cli` mode, the preceding YAML file is not required. However, you need to write the complete information about parameters in CLI mode. Example:
79
-
54
+
This setup's `website-starter` segment can normally be deployed with `s website-starter deploy`.
55
+
However, to deploy via `cli` mode, you bypass the Yaml file and directly input complete parameter details on the command line:
80
56
```shell script
81
57
s cli devsapp/website deploy -p "{\"bucket\":\"testbucket\",\"src\":{\"codeUri\":\"./\",\"publishDir\":\"./build\",\"index\":\"index.html\"},\"region\":\"cn-hangzhou\",\"hosts\":[{\"host\":\"auto\"}]}" -a myaccess
82
58
```
83
-
84
-
### Support for specific components
85
-
86
-
Among the existing components of Serverless Devs, some excellent components, such as the fc-api component, for CLI mode already exist. You can use this component together with Alibaba Cloud Function Compute API operations to perform specified actions:
87
-
- If you want to view functions of a service in Alibaba Cloud Function Compute in a region, run the following command:
88
-
```shell script
89
-
s cli fc-api listFunctions --service-name my-service --region cn-beijing -a myaccess
90
-
```
91
-
- You can run the following command in CLI mode to update code for functions:
In addition, many components that use the YAML mode can deliver better performance. Under certain conditions, you can also perform additional optimization for CLI mode. For example, if you want to synchronize the on- and off-premises resources of the `fc` component, you can run the following command:
97
-
59
+
### Specific Component Support
60
+
Serverless Devs offers several well-designed components that are optimized for Cli mode. For example, the `fc api` component is prioritized for command line usage, facilitating quick interactions with certain Aliyun Function Compute (FC) service interfaces, such as:
61
+
- Listing functions within a specified service and region:
62
+
```shell script
63
+
s cli fc api listFunctions --service-name my-service --region cn-beijing -a myaccess
64
+
```
65
+
- Updating function code via the command line:
66
+
```shell script
67
+
s cli fc api updateFunction --region cn-hangzhou --serviceName fc-deploy-service --functionName http-trigger-function --code '{"zipFile":"./"}'
68
+
```
69
+
Furthermore, several components that typically support Yaml mode may also offer an optimized pure command line interface for specific operations. An example is the `fc` component, which provides commands for resource synchronization:
98
70
```shell script
99
-
s cli fc sync --region cn-shanghai --service-name myService --type config
100
-
```
71
+
s cli fc sync --region cn-shanghai --service-name myService --type config
fc 0.1.27 100 MB Aliyun Function Compute Base Component
49
+
devsapp/fc 0.1.27 100 MB Aliyun Function Compute Base Component
50
+
fc api 0.0.44 100 MB Function Compute api operation component
76
51
```
77
-
78
-
79
-
## Precautions
80
-
When you query a component, the system displays the information about the current registry and the default GitHub registry. If you need to view other registries, run the `s set registry` command to switch registries.
0 commit comments