Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Ruby | CLI | Be Helpful | Documenting an App's Description and Invocation Syntax

概要

書籍 Build Awesome Command-Line Applications in Ruby2

Be Helpful

詳細

ユーザーが最初に期待するのは1行の要約を記した banner を見ることです。

コマンドを持たないシンプルなアプリケーション

典型的なフォーマットは下記のようになります

executable [options] arg_name1 arg_name2
各要素 内容
executable 実行可能なアプリケーション名
options オプションを含むアプリケーションであることを示す
arg_name1, arg_name2 引数名
コマンドを持つ Command suit

典型的なフォーマットは下記のようになります

executable [global options] command [command options] arg_name1 arg_name2
各要素 内容
executable 実行可能なアプリケーション名
global options 個別のコマンドに依存しないオプションがあることを示す
command 実行可能なコマンド名
command options 個別のコマンドに依存するコマンドのオプションがあることを示す
arg_name1, arg_name2 引数名
注意点

・同一の種類の引数を多数とる場合は、省略記法を利用する。
例えば

arg_name...