Repository navigation
feat: 標準入力対応を実装 - #23
Merged
Merged
Conversation
パイプやヒアドキュメントからタスクを追加できるように、標準入力対応を実装しました。 実装内容: - readFromStdin() 関数を追加 - os.Stdin.Stat() で標準入力の状態を確認 - パイプの場合のみ読み取り - bufio.Scanner で複数行を読み取り - 改行を保持して結合 - commands/add.go の Run() を更新 - 引数がある場合: 引数を優先 - 引数がない場合: 標準入力から読み取り - 空入力時はエラーメッセージを表示 - quietモードと組み合わせ可能 使用例: # パイプで追加 echo "タスク" | todo add # ヒアドキュメント(複数行) todo add <<EOF # データベース最適化 ## 背景 検索が遅い ## 実施内容 1. インデックス追加 EOF # quietと組み合わせ echo "タスク" | todo add -q 受け入れ基準: ✅ echo "タスク" | todo add が動作する ✅ 複数行のヒアドキュメントが正しく保存される ✅ 空入力時はエラーメッセージが表示される ✅ 引数がある場合は引数が優先される ✅ --quiet と組み合わせて使える Closes #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概要
パイプやヒアドキュメントからタスクを追加できるように、標準入力対応を実装しました。
関連Issue
Closes #9
変更内容
新規関数
os.Stdin.Stat()で標準入力の状態を確認bufio.Scannerで複数行を読み取り既存ファイルの更新
使用例
テスト方法
受け入れ基準
echo "タスク" | todo addが動作する--quietと組み合わせて使えるチェックリスト
go fmt)