Skip to content

Commit

Permalink
Merge pull request #286 from cmleinz/cli-refactor
Browse files Browse the repository at this point in the history
Refactor CLI code
  • Loading branch information
ChristopherRabotin committed Aug 7, 2024
2 parents 32d38e4 + 24742c7 commit 3eab6eb
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 225 deletions.
50 changes: 28 additions & 22 deletions anise-cli/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::path::PathBuf;

use clap::{Parser, Subcommand};
use clap::{Args, Parser, Subcommand};
use hifitime::Epoch;

#[derive(Parser, Debug)]
#[clap(name="ANISE", author="Rabotin and ANISE contributors", version, about, long_about = None)]
pub struct Args {
pub struct CliArgs {
#[clap(subcommand)]
pub action: Actions,
}
Expand Down Expand Up @@ -43,26 +43,32 @@ pub enum Actions {
/// Truncate the segment of the provided ID of the input NAIF DAF file to the provided start and end epochs
/// Limitation: this may not work correctly if there are several segments with the same ID.
/// Only works with Chebyshev Type 2 data types (i.e. planetary ephemerides).
TruncDAFById {
/// Input DAF file, SPK or BPC
input: PathBuf,
/// Output DAF file path
output: PathBuf,
/// ID of the segment to truncate
id: i32,
/// New start epoch of the segment
start: Option<Epoch>,
/// New end epoch of the segment
end: Option<Epoch>,
},
TruncDAFById(TruncateById),
/// Remove the segment of the provided ID of the input NAIF DAF file.
/// Limitation: this may not work correctly if there are several segments with the same ID.
RmDAFById {
/// Input DAF file, SPK or BPC
input: PathBuf,
/// Output DAF file path
output: PathBuf,
/// ID of the segment to truncate
id: i32,
},
RmDAFById(RmById),
}

#[derive(Debug, PartialEq, Eq, PartialOrd, Args)]
pub(crate) struct RmById {
/// Input DAF file, SPK or BPC
pub input: PathBuf,
/// Output DAF file path
pub output: PathBuf,
/// ID of the segment to truncate
pub id: i32,
}

#[derive(Debug, PartialEq, Eq, PartialOrd, Args)]
pub(crate) struct TruncateById {
/// Input DAF file, SPK or BPC
pub input: PathBuf,
/// Output DAF file path
pub output: PathBuf,
/// ID of the segment to truncate
pub id: i32,
/// New start epoch of the segment
pub start: Option<Epoch>,
/// New end epoch of the segment
pub end: Option<Epoch>,
}
Loading

0 comments on commit 3eab6eb

Please sign in to comment.