Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/bin/rage/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,24 @@ fn decrypt(opts: AgeOptions) -> Result<(), error::DecryptError> {
}

fn main() -> Result<(), error::Error> {
use std::env::args;

env_logger::builder().format_timestamp(None).init();

let args = args().collect::<Vec<_>>();

// If you are piping input with no other args, this will not allow
// it.
if console::user_attended() && args.len() == 1 {
// If gumdrop ever merges that PR, that can be used here
// instead.
println!("Usage: {} [OPTIONS]", args[0]);
println!();
println!("{}", AgeOptions::usage());

return Ok(());
}

let opts = AgeOptions::parse_args_default_or_exit();

if opts.decrypt {
Expand Down