hmcs config
Desktop Homunculus のアプリ設定を管理します。
クイックスタート
hmcs config list
hmcs config get port
hmcs config set port 3200
hmcs config set mods_dir /Users/me/.homunculus/mods
hmcs config reset port
hmcs config reset --all
list
構文
hmcs config list
引数
このサブコマンドには引数はありません。
例
成功:
KEY VALUE
mods_dir /Users/me/.homunculus/mods
port 3100
失敗例:
[stderr]
...failed to parse ~/.homunculus/config.toml...
動作
~/.homunculus/config.tomlから設定を読み込みます。- KEY と VALUE のカラムをキーでソートしたテーブルを出力します。
- 設定ファイルが存在しない場合はデフォルト値が使用されます。
関連
get
構文
hmcs config get <key>
引数
| 名前 | 必須 | 説明 |
|---|---|---|
key | はい | 読み取る設定キー。 |
例
成功:
hmcs config get port
3100
失敗例:
hmcs config get foo
[stderr]
error: unknown config key 'foo'. ...valid keys: mods_dir, port
動作
- 現在のキーは
mods_dirとportです。 - 不明なキーの場合はゼロ以外で終了します。
関連
set
構文
hmcs config set <key> <value>
引数
| 名前 | 必須 | 説明 |
|---|---|---|
key | はい | 書き込む設定キー(mods_dir または port)。 |
value | はい | 新しい値。可能な場合は TOML リテラルとしてパースされます。 |
例
成功:
hmcs config set port 3200
hmcs config set mods_dir /Users/me/.homunculus/mods
失敗例(不明なキー):
hmcs config set foo bar
[stderr]
error: unknown config key 'foo'. ...valid keys: mods_dir, port
失敗例(無効な型):
hmcs config set port not_a_number
[stderr]
error: invalid value for 'port': ...
動作
- 現在の設定を読み込み、1つのキー変更を適用してから書き戻します。
- 値のパース順序:
- TOML リテラルとしてパース(数値、ブール値、クォートされた文字列用)。
- パースに失敗した場合、値をプレーン文字列として扱います。
- 検証に失敗した場合はゼロ以外で終了します。
関連
reset
構文
hmcs config reset <key>
hmcs config reset --all
引数
| 名前 | 必須 | 説明 |
|---|---|---|
key | いいえ | デフォルト値にリセットする設定キー。 |
--all | いいえ | すべてのキーをデフォルト値にリセット。 |
key または --all のいずれかを指定する必要があります。
例
単一のキーをリセット:
hmcs config reset port
port = 3100
すべてのキーをリセット:
hmcs config reset --all
all config reset to defaults
失敗例(引数なし):
hmcs config reset
[stderr]
error: specify a key to reset, or use --all to reset all config
動作
- キー指定時:そのキーの値をデフォルトに置き換えて保存します。
{key} = {デフォルト値}を出力します。 --all指定時:デフォルト設定(port = 3100、mods_dir = ~/.homunculus/mods/)を保存します。- 不明なキーの場合はゼロ以外で終了します。