天天看點

函數計算工具 fcli 開源啦

fcli 是 阿裡雲函數計算

的指令行工具,可以便捷的管理函數計算中的資源。目前 fcli 已經在 Github 上開源,誠摯的歡迎各位開源愛好者來為函數計算工具 fcli 貢獻代碼,使函數計算工具 fcli 更加強大,為使用者帶來更加友好的體驗。

Github 位址:

https://github.com/aliyun/fcli

fcli 使用指南

想要使用 fcli,隻需要在

aliyun/fcli Releases

中下載下傳對應作業系統的版本并解壓安裝,在指令行中使用即可。憑借 fcli 可以很友善的在本地管理函數計算中的資源或 invoke function,快速看到效果。

$ fcli
fcli: function compute command line tools

Usage:
  fcli [flags]
  fcli [command]

Available Commands:
  alias           alias related operation
  config          Configure the fcli
  function        function related operation
  help            Help about any command
  service         service related operation
  shell           interactive shell
  sls             sls related operation
  trigger         trigger related operation
  version         fcli version information

Flags:
  -h, --help   help for fcli

Use "fcli [command] --help" for more information about a command.

$ fcli service
service related operation

Usage:
  fcli service [flags]
  fcli service [command]

Aliases:
  service, s

Available Commands:
  create      create service
  delete      Delete service
  get         Get the information of service
  list        List services of the current account
  update      update service
  version     service version related operation

Flags:
      --help   Print Usage (default true)

Use "fcli service [command] --help" for more information about a command.
           

通過 fcli 的

shell

子指令,可以進入互動模式

$ fcli shell
Welcome to the function compute world. Have fun!
>>> ls
demo
>>>             

更加詳細的使用方法,請見

函數計算工具 fcli 幫助文檔

如何貢獻代碼

開發環境配置

1. 安裝并配置 Golang 開發環境

根據

官方文檔

安裝并設定環境變量,主要是設定好

$GOPATH

環境變量。

2. Fork Repository

  • aliyun/fcli 項目中,點選

    fork

    ,将項目 fork 到個人倉庫
  • 在本地

    $GOPATH/src

    目錄下,建立

    github.com/aliyun

    目錄
  • cd ${GOPATH}/src/github.com/aliyun

  • git clone https://github.com/個人賬号/fcli.git

3. 安裝 glide 包管理器

$ go get github.com/Masterminds/glide
$ go install github.com/Masterminds/glide           

4. 安裝依賴

在項目根目錄下,執行

glide i -v

進行依賴安裝

送出 pull request

1. 将修改 push 到個人賬号裡的本地倉庫

2. 發起 pull request 請求

在 pull request 請求的 comment 中,寫明此次修改的内容,并添加此次修改的指令互動示例。

假設此次修改設定到 service list 子指令

  • fcli service
$ fcli service
service related operation

Usage:
  fcli service [flags]
  fcli service [command]

Aliases:
  service, s

Available Commands:
  create      create service
  delete      Delete service
  get         Get the information of service
  list        List services of the current account
  update      update service
  version     service version related operation

Flags:
      --help   Print Usage (default true)

Use "fcli service [command] --help" for more information about a command.           
  • fcli service list --help
william:fcli zechen$ go run main.go service list --help
List services of the current account

Usage:
  fcli service list [option] [flags]

Aliases:
  list, l

Flags:
      --help                list functions
  -l, --limit int32         the max number of the returned services (default 100)
      --name-only           display service name only (default true)
  -t, --next-token string   continue listing the functions from the previous point
  -p, --prefix string       list the services whose names contain the specified prefix
  -k, --start-key string    start key is where you want to start listing from           
  • fcli service list
$ fcli service list
{
  "Services": [
    "demo"
  ],
  "NextToken": null
}           

我們鼓勵将此次修改涉及的指令互動,展現的越詳細越好。(還可以測試此次修改影響到的指令的各種參數)

版本号說明

fcli 在開源後使用

主版本号.次版本号.修訂号

的版本格式

關于版本格式,可以參考

Semantic Versioning