|
1 | 1 | use clap::{Args, Subcommand}; |
2 | 2 | use std::path::PathBuf; |
3 | | -// Subcommand: parses command-line subcommands into the user-defined enum. |
4 | | -// Args: We need to use clap::Args to parse the arguments for each command |
5 | | - |
6 | | -pub mod build; |
7 | | -pub mod check; |
8 | | -pub mod create_request; |
9 | | -pub mod subset; |
| 3 | +// use crate::core::{Rap, CheckedRap}; |
| 4 | +// use crate::core::check::check_request; |
| 5 | +// use crate::core::metadata::{Package, read_package_metadata}; |
| 6 | +// use crate::core::subset::{create_plan, SubsettedResource, subset_resources, |
| 7 | +// write_resources}; use std::path::PathBuf; // Or `Path`? |
10 | 8 |
|
11 | 9 | #[derive(Debug, Args)] |
12 | 10 | pub struct BuildArgs { |
@@ -71,3 +69,49 @@ pub enum Commands { |
71 | 69 | /// package. |
72 | 70 | Subset(SubsetArgs), |
73 | 71 | } |
| 72 | + |
| 73 | +/// Creates the requested subsets from the data package. |
| 74 | +/// |
| 75 | +/// # Argument: |
| 76 | +/// |
| 77 | +/// - `args`: This is the [`SubsetArgs`] struct that contains the CLI arguments |
| 78 | +/// for the `subset` command. |
| 79 | +#[allow(unused, clippy::needless_pass_by_value)] |
| 80 | +pub fn subset(args: SubsetArgs) { |
| 81 | + // TODO: Will we need to include some failure match here for reading issues? |
| 82 | + |
| 83 | + // let request: Request = read_request(args.request)?; |
| 84 | + |
| 85 | + // if args.show_plan { |
| 86 | + // // TODO: Not sure println is right approach. |
| 87 | + // println!("Plan for subsetting: {:?}", create_plan(args.request)); |
| 88 | + // // End early. |
| 89 | + // return; |
| 90 | + // }; |
| 91 | + |
| 92 | + // TODO: Will we need to include some failure match here for reading issues? |
| 93 | + // let package_metadata: Package = read_package_metadata(args.source)?; |
| 94 | + |
| 95 | + // let checked_rap: CheckedRap = check_request(Rap { |
| 96 | + // package: package_metadata, |
| 97 | + // request: request |
| 98 | + // }); |
| 99 | + |
| 100 | + // TODO: Not sure if Vec or Arc should be used. |
| 101 | + // TODO: Need to include failure matches here? |
| 102 | + // let subsetted_resources: Arc<[SubsettedResource]> = |
| 103 | + // subset_resources(checked_rap)?; |
| 104 | + |
| 105 | + // TODO: Not sure if Path or PathBuf is better here. |
| 106 | + // let written_resources: Result<Path, Error> = |
| 107 | + // write_resources(subsetted_resources, args.output_dir); |
| 108 | + |
| 109 | + // TODO: Need to include failure matches here? |
| 110 | + |
| 111 | + // match written_resources { |
| 112 | + // Ok(paths) => println!("Created subset: {:?}", paths), |
| 113 | + // Err(e) => eprintln!("Failed to write ") |
| 114 | + // } |
| 115 | + |
| 116 | + todo!("Planned") |
| 117 | +} |
0 commit comments