envfile サブコマンド #9
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
sprout envfile サブコマンドの実装が完了しました。
実装内容
新規ファイル作成
src/sprout/commands/envfile.py - envfileコマンドの実装
既存ファイル更新
src/sprout/cli.py - envfileコマンドの登録
CHANGELOG.md - 新機能の記録
テスト追加
tests/test_envfile.py - 包括的なユニットテスト
機能確認
✅ 現在のディレクトリから再帰的に .env.example を検索
✅ 各 .env.example から .env ファイルを生成
✅ プレースホルダーの処理({{ auto_port() }}, {{ branch() }}, {{ VARIABLE }})
✅ --force オプションで既存ファイルの上書き
✅ --dry-run オプションでプレビューモード
✅ --silent オプションで出力抑制
✅ lint/formatチェック通過
✅ 全72テスト通過
既存の parse_env_template 関数を活用してテキスト処理を行い、CLI部分のみを新規実装する形で、効率的に実装できました。