add clap args & subcommands

axtloss/rework-partitioning
amy 3 years ago
parent 40c95eaa5c
commit 6ae8149647

108
Cargo.lock generated

@ -2,6 +2,114 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "jade" name = "jade"
version = "0.1.0" version = "0.1.0"
dependencies = [
"clap",
]
[[package]]
name = "libc"
version = "0.2.112"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "unicode-width"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

@ -6,3 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
clap = "2.34.0"

@ -1,3 +1,120 @@
use clap::{App, AppSettings, Arg, ArgMatches, ArgSettings, Shell, SubCommand};
fn main() { fn main() {
println!("Hello, world!"); let app = App::new("jade")
.version(env!("CARGO_PKG_VERSION"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.subcommand(
SubCommand::with_name("set")
.about("Sets a value for installation")
.subcommand(
SubCommand::with_name("partition")
.about("Partition the install destination")
.arg(
Arg::with_name("mode")
.help("If jade should automatically partition (mode = auto) or the user manually partitioned it (mode = manual)")
.required(true),
)
.arg(
Arg::with_name("root")
.help("The root partition to use (only read if mode is manual)")
.required_if("mode", "manual"),
)
.arg(
Arg::with_name("boot")
.help("The boot partition to use (only read if mode is manual)")
.required_if("mode", "manual"),
)
.arg(
Arg::with_name("swap")
.help("The swap partition to use (only read if mode is manual)")
.required_if("mode", "manual"),
),
)
.subcommand(
SubCommand::with_name("timezone")
.about("Set the timezone")
.arg(
Arg::with_name("timezone")
.help("The timezone to set")
.required(true),
),
)
.subcommand(
SubCommand::with_name("locales")
.about("Set the locales")
.arg(
Arg::with_name("locales")
.help("The locales to set")
.multiple(true)
.index(1)
.required(true),
),
)
.subcommand(
SubCommand::with_name("hostname")
.about("Set the hostname")
.arg(
Arg::with_name("hostname")
.help("The hostname to set")
.required(true),
),
)
.subcommand(
SubCommand::with_name("ipv6")
.about("Activate IPv6")
.arg(
Arg::with_name("ipv6")
.help("If ipv6 should be activated")
.required(true),
),
)
.subcommand(
SubCommand::with_name("rootPass")
.about("Set the root password")
.arg(
Arg::with_name("rootPass")
.help("The root password to set")
.required(true),
),
)
.subcommand(
SubCommand::with_name("newUser")
.about("Create a new user")
.arg(
Arg::with_name("username")
.help("The username to create")
.required(true),
)
.arg(
Arg::with_name("password")
.help("The password to set")
.required(true),
)
)
.subcommand(
SubCommand::with_name("graphical")
.about("Graphical stuff (Desktop environment and Display Manager)")
.arg(
Arg::with_name("de")
.help("The Desktop envionment to install")
.required(true),
)
.arg(
Arg::with_name("dm")
.help("The Display Manager to install")
.required(true),
),
)
.subcommand(
SubCommand::with_name("flatpak")
.about("Flatpak")
.arg(
Arg::with_name("flatpak")
.help("If flatpak should be installed")
.required(true),
),
)
)
.get_matches();
} }

Loading…
Cancel
Save