Skip to content

Commit

Permalink
style: cli changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arghyadipchak committed Sep 8, 2024
1 parent 6ec6d26 commit de8d86f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@ pub struct Cli {
#[derive(Subcommand)]
pub enum Commands {
ListAssignments {
#[arg(short, long)]
#[arg(short, long, help = "Course id")]
course_id: u64,
},

DownloadSubmissions {
#[arg(short, long)]
#[arg(short, long, help = "Course id")]
course_id: u64,

#[arg(short, long)]
#[arg(short, long, help = "Assignment id")]
assignment_id: u64,

#[arg(short, long)]
#[arg(
short,
long,
help = "Output file [default: assignment_{assignment_id}.yml]"
)]
output_file: Option<PathBuf>,
},

UploadGrades {
#[arg(short, long)]
#[arg(short, long, help = "Assignment file")]
file: PathBuf,
},
}
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ fn download_submissions(
})
.collect();

let out_file = output_file.unwrap_or_else(|| {
let output_file = output_file.unwrap_or_else(|| {
PathBuf::from(format!("assignment_{assignment_id}.yml"))
});
let fh = File::create(&out_file)?;
let fh = File::create(output_file)?;

write!(&fh, "{MOODY_DICLAIMER}\n\n")?;
serde_yaml::to_writer(
Expand All @@ -139,8 +139,6 @@ fn download_submissions(
},
)?;

println!("{}", out_file.to_string_lossy());

Ok(())
}

Expand Down

0 comments on commit de8d86f

Please sign in to comment.