Skip to content

gopose status コマンドを実装しました#37

Merged
harakeishi merged 2 commits intoharakeishi:mainfrom
takigawaakinori:feature/gopose-status-command
Feb 17, 2026
Merged

gopose status コマンドを実装しました#37
harakeishi merged 2 commits intoharakeishi:mainfrom
takigawaakinori:feature/gopose-status-command

Conversation

@takigawaakinori
Copy link
Contributor

@takigawaakinori takigawaakinori commented Feb 12, 2026

概要

gopose status コマンドを実装し、Docker Composeプロジェクトのポートマッピング状態を確認できるようにしました。compose.override.ymlによるオーバーライド状況も表示され、どのポートが変更されているかを一目で把握できます。

--detailed は雛形にはありましたが、未実装です。

変更内容

  • cmd/status.gogopose status コマンドの実装を追加
    • Docker Composeファイルの自動検出機能(-f フラグでの手動指定にも対応)
    • compose.override.yml / docker-compose.override.yml の読み込み機能
    • サービスごとのポート情報収集(アルファベット順でソート)
    • テーブル形式(デフォルト)とJSON形式(-o json)の出力対応
    • オーバーライドされたポートの視覚的な表示(元のポート番号も併記)
  • cmd/status_test.go に包括的なテストスイートを追加(8テストケース群)
    • collectPortInfos 関数のユニットテスト(8ケース)
    • outputTable 関数の出力検証テスト
    • outputJSON 関数の出力検証テスト
    • loadOverrideConfig 関数のテスト(存在有無、複数ファイル形式対応)
    • PortInfo のJSONシリアライズテスト

期待すること

  • ユーザーが現在のポートマッピング状態を簡単に確認できること
  • オーバーライドされたポートが明確に識別できること
  • JSON出力により、他ツールとの連携やスクリプトでの利用が容易になること

動作確認

項目 証憑(スクショなど) 備考
go test ./... -count=1 全パッケージPASS スクリーンショット 2026-02-13 0 05 29 全テストがPASS
go vet ./... 警告なし - 静的解析エラーなし
go build 成功 - バイナリ正常生成
gopose status --help ヘルプ表示 - フラグ・説明文が正しく表示されること
gopose status テーブル出力 スクリーンショット 2026-02-13 0 02 09 SERVICE / HOST PORT / CONTAINER PORT / STATUS カラムで表示
gopose status -o json JSON出力 スクリーンショット 2026-02-13 0 03 48 整形されたJSON形式で出力されること
gopose status -f custom.yml ファイル指定 スクリーンショット 2026-02-13 0 04 32 指定ファイルを解析して表示すること
オーバーライドされたポートの表示 スクリーンショット 2026-02-13 0 04 32 overridden (元ポート番号) 形式でSTATUSカラムに表示されること

@takigawaakinori takigawaakinori marked this pull request as ready for review February 12, 2026 15:01
@takigawaakinori takigawaakinori changed the title Implement gopose status command gopose status コマンドを実装しました Feb 12, 2026
Copy link
Owner

@harakeishi harakeishi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRありがとうございます!!!

@harakeishi harakeishi merged commit 27f1398 into harakeishi:main Feb 17, 2026
4 checks passed
@harakeishi
Copy link
Owner

@all-contributors please add @akinoriakatsuka for code

@allcontributors
Copy link
Contributor

@harakeishi

I've put up a pull request to add @akinoriakatsuka! 🎉

@takigawaakinori
Copy link
Contributor Author

@harakeishi
いつも、k1LoW/git-wtと組み合わせて、AIの並列稼働に大変よく使わせていただいています。ありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants