File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,17 @@ use crate::types::{Section, Story};
77#[ command(
88 name = "hackertuah" ,
99 version,
10- about = "Hacker News in your terminal — TUI by default, agent-friendly subcommands for scripts"
10+ about = "Hacker News in your terminal — TUI by default, agent-friendly subcommands for scripts" ,
11+ after_help = "Exit codes:
12+ 0 success
13+ 1 network/runtime failure
14+ 2 usage error (also returned when the TUI is invoked with piped stdout)
15+
16+ Subcommands write data to stdout and progress/errors to stderr.
17+
18+ Examples:
19+ hackertuah stories --limit 10 --json | jq -r '.[].title'
20+ hackertuah stories ask --json"
1121) ]
1222pub struct Cli {
1323 #[ command( subcommand) ]
@@ -155,6 +165,15 @@ mod tests {
155165 assert_eq ! ( Section :: from( CliSection :: Jobs ) . as_str( ) , "Jobs" ) ;
156166 }
157167
168+ #[ test]
169+ fn help_documents_exit_codes_and_examples ( ) {
170+ use clap:: CommandFactory ;
171+ let help = Cli :: command ( ) . render_long_help ( ) . to_string ( ) ;
172+ assert ! ( help. contains( "Exit codes:" ) ) ;
173+ assert ! ( help. contains( "Examples:" ) ) ;
174+ assert ! ( help. contains( "--json | jq" ) ) ;
175+ }
176+
158177 fn sample_story ( ) -> Story {
159178 Story {
160179 id : 42 ,
You can’t perform that action at this time.
0 commit comments