1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Salesforce CLI のコマンドオートコンプリートを試してみた

Posted at

Salesforce CLI のコマンドオートコンプリートとは

Salesforce の Spring '20 でリリースされた Salesforce CLI のプラグインです。以下のようにタブキーを 2 回押すことでコマンドやフラグの候補を表示できるので、ド忘れした場合などに便利ですね。

sfdx force:org:list --<タブキー><タブキー>
--all   --json     --noprompt              --verbose               
--clean --loglevel --skipconnectionstatus  

インストールと初期設定

Salesforce CLI がインストールされた環境で以下のコマンドを実行してプラグインをインストールします。

$ sfdx plugins:install @oclif/plugin-autocomplete

その後、以下のコマンドを実行すると環境変数も修正するように指示が出るので従います。
私は Mac のデフォルトに合わせたので zshrc を書き換えていますが、利用しているシェルに合わせてください。

$ sfdx autocomplete
$ printf "$(sfdx autocomplete:script bash)" >> ~/.zshrc; source ~/.zshrc

動作を確認

以下のコマンドを実行してそれぞれ候補が表示されるか確認してみましょう。

$ sfdx <タブキー><タブキー>
$ sfdx force:source:<タブキー><タブキー>
$ sfdx force:org:list --<タブキー><タブキー>
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?