Skip to content

Commit

Permalink
feat(jssp): strip not necessary cli parameters (#422)
Browse files Browse the repository at this point in the history
## Description

Changes done in sync with ec datakit

## Linked issues

Closes #420
  • Loading branch information
kkafar authored Aug 23, 2023
1 parent 79d3176 commit 7996c76
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions examples/jssp/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,19 @@ use std::path::PathBuf;
/// Jssp instance solver
#[derive(Parser, Debug, Clone)]
pub struct Args {
/// Path to the data directory
/// DO NOT USE (not implemented yet)
#[arg(short = 'i', long = "input-dir")]
pub input_dir: Option<PathBuf>,

/// Path to the single data file
#[arg(short = 'f', long = "input-file")]
pub input_file: PathBuf,

/// Output data directory
/// DO NOT USE (not implemented yet)
#[arg(long = "output-dir")]
pub output_dir: Option<PathBuf>,

/// Output file name
#[arg(short = 'o', long = "output-file")]
pub output_file: PathBuf,
}

fn validate_args(args: &Args) -> Result<(), String> {
let cloned_args = args.clone();
if !args.input_file.is_file() {
return Err("Specified data input file does not exist or is not a file".to_owned());
}
if args.input_dir.is_some() && !cloned_args.input_dir.unwrap().is_dir() {
return Err("Specified data input directory does not exist or is not a directory".to_owned());
}
if args.output_dir.is_some() && !cloned_args.output_dir.unwrap().is_dir() {
return Err("Specified data output directory does not exist or is not a directory".to_owned());
}
// It does not have to exist -- it will be created
// if !args.output_file.is_file() {
// return Err("Specified data output file does not exist or is not a directory".to_owned());
// }
Ok(())
}

Expand Down

0 comments on commit 7996c76

Please sign in to comment.