File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ fn cache_dir() -> &'static OsStr {
132132
133133/// Builds an index for nix-locate
134134#[ derive( Debug , Parser ) ]
135- #[ clap( author, about, version) ]
135+ #[ clap( author, about, version, name = "nix-index" ) ]
136136struct Args {
137137 /// Make REQUESTS http requests in parallel
138138 #[ clap( short = 'r' , long = "requests" , default_value = "100" ) ]
@@ -168,12 +168,28 @@ struct Args {
168168 /// Note: does not check if the cached data is up to date! Use only for development.
169169 #[ clap( long) ]
170170 path_cache : bool ,
171+
172+ /// Generate man page, then exit
173+ #[ clap( long, hide = true ) ]
174+ mangen : bool ,
171175}
172176
173177#[ tokio:: main]
174178async fn main ( ) {
175179 let args = Args :: parse ( ) ;
176180
181+ if args. mangen {
182+ use clap:: CommandFactory ;
183+ let man = clap_mangen:: Man :: new ( Args :: command ( ) ) ;
184+
185+ if let Err ( err) = man. render ( & mut std:: io:: stdout ( ) ) {
186+ eprintln ! ( "error: {}" , err) ;
187+ process:: exit ( 2 )
188+ } else {
189+ return ;
190+ }
191+ }
192+
177193 if let Err ( e) = update_index ( & args) . await {
178194 eprintln ! ( "error: {:?}" , e) ;
179195 process:: exit ( 2 ) ;
You can’t perform that action at this time.
0 commit comments