get rid of 'set' subcommand, works without it

axtloss/rework-partitioning
amy 3 years ago
parent 3422c43ef3
commit fea04b3697

@ -0,0 +1,9 @@
pub fn partition(root: &str, boot: &str, swap: &str, mode: &str, device: &str) {
if mode == "manual" {
println!("Using {} as root partition", root);
println!("Using {} as boot partition", boot);
println!("Using {} as swap partition", swap);
} else {
println!("automatically partitioning {}", device);
}
}

@ -4,9 +4,6 @@ fn main() {
let app = App::new("jade") let app = App::new("jade")
.version(env!("CARGO_PKG_VERSION")) .version(env!("CARGO_PKG_VERSION"))
.about(env!("CARGO_PKG_DESCRIPTION")) .about(env!("CARGO_PKG_DESCRIPTION"))
.subcommand(
SubCommand::with_name("set")
.about("Sets a value for installation")
.subcommand( .subcommand(
SubCommand::with_name("partition") SubCommand::with_name("partition")
.about("Partition the install destination") .about("Partition the install destination")
@ -29,6 +26,11 @@ fn main() {
Arg::with_name("swap") Arg::with_name("swap")
.help("The swap partition to use (only read if mode is manual)") .help("The swap partition to use (only read if mode is manual)")
.required_if("mode", "manual"), .required_if("mode", "manual"),
)
.arg(
Arg::with_name("device")
.help("The device to partition (only read if mode is automatic)")
.required_if("mode", "auto"),
), ),
) )
.subcommand( .subcommand(
@ -114,19 +116,20 @@ fn main() {
.help("If flatpak should be installed") .help("If flatpak should be installed")
.required(true), .required(true),
), ),
)
).get_matches(); ).get_matches();
if let Some(app) = app.subcommand_matches("set") {
if let Some(app) = app.subcommand_matches("partition") { if let Some(app) = app.subcommand_matches("partition") {
let mode = app.value_of("mode").unwrap(); let mode = app.value_of("mode").unwrap();
let root = app.value_of("root").unwrap_or("none"); let root = app.value_of("root").unwrap_or("none");
let boot = app.value_of("boot").unwrap_or("none"); let boot = app.value_of("boot").unwrap_or("none");
let swap = app.value_of("swap").unwrap_or("none"); let swap = app.value_of("swap").unwrap_or("none");
let device = app.value_of("device").unwrap_or("none");
println!("mode: {}", mode); println!("mode: {}", mode);
println!("root: {}", root); println!("root: {}", root);
println!("boot: {}", boot); println!("boot: {}", boot);
println!("swap: {}", swap); println!("swap: {}", swap);
println!("device: {}", device);
} else if let Some(app) = app.subcommand_matches("timezone") { } else if let Some(app) = app.subcommand_matches("timezone") {
let timezone = app.value_of("timezone").unwrap(); let timezone = app.value_of("timezone").unwrap();
println!("{}", timezone); println!("{}", timezone);
@ -155,7 +158,6 @@ fn main() {
} else if let Some(app) = app.subcommand_matches("flatpak") { } else if let Some(app) = app.subcommand_matches("flatpak") {
let flatpak = app.value_of("flatpak").unwrap(); let flatpak = app.value_of("flatpak").unwrap();
println!("{}", flatpak); println!("{}", flatpak);
}
} else { } else {
println!("Running TUI installer"); println!("Running TUI installer");
} }

Loading…
Cancel
Save