Compare commits
2 Commits
f7aa8942e0
...
6705c283af
Author | SHA1 | Date |
---|---|---|
Moritz Böhme | 6705c283af | |
Moritz Böhme | 3b12d7bb59 |
|
@ -343,6 +343,16 @@ version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_mangen"
|
||||||
|
version = "0.2.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf8e5f34d85d9e0bbe2491d100a7a7c1007bb2467b518080bfe311e8947197a9"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"roff",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -948,6 +958,12 @@ version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
|
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "roff"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.37.20"
|
version = "0.37.20"
|
||||||
|
@ -1165,6 +1181,7 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete_command",
|
"clap_complete_command",
|
||||||
|
"clap_mangen",
|
||||||
"humantime",
|
"humantime",
|
||||||
"libc",
|
"libc",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
|
|
|
@ -9,6 +9,7 @@ edition = "2021"
|
||||||
anyhow = "1.0.71"
|
anyhow = "1.0.71"
|
||||||
clap = { version = "4.3.4", features = ["derive"] }
|
clap = { version = "4.3.4", features = ["derive"] }
|
||||||
clap_complete_command = "0.5.1"
|
clap_complete_command = "0.5.1"
|
||||||
|
clap_mangen = "0.2.13"
|
||||||
humantime = "2.1.0"
|
humantime = "2.1.0"
|
||||||
libc = "0.2.147"
|
libc = "0.2.147"
|
||||||
notify-rust = "4.8.0"
|
notify-rust = "4.8.0"
|
||||||
|
|
|
@ -13,10 +13,13 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.default = naersk-lib.buildPackage {
|
packages.default = naersk-lib.buildPackage {
|
||||||
src = ./.;
|
src = pkgs.lib.sourceFilesBySuffices ./. [ ".rs" ".toml" ".lock" ];
|
||||||
nativeBuildInputs = with pkgs; [ installShellFiles ];
|
nativeBuildInputs = with pkgs; [ installShellFiles ];
|
||||||
meta.mainProgram = "timers";
|
meta.mainProgram = "timers";
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
$out/bin/timers manpage timers.1
|
||||||
|
installManPage timers.1
|
||||||
|
|
||||||
installShellCompletion --cmd timers \
|
installShellCompletion --cmd timers \
|
||||||
--bash <($out/bin/timers completions bash) \
|
--bash <($out/bin/timers completions bash) \
|
||||||
--fish <($out/bin/timers completions fish) \
|
--fish <($out/bin/timers completions fish) \
|
||||||
|
|
|
@ -61,6 +61,12 @@ pub enum Command {
|
||||||
Completions {
|
Completions {
|
||||||
#[arg(value_enum)]
|
#[arg(value_enum)]
|
||||||
shell: clap_complete_command::Shell,
|
shell: clap_complete_command::Shell,
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Generate man page (section 1)
|
||||||
|
Manpage {
|
||||||
|
/// File to save the man page to
|
||||||
|
file_path: String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use std::io::Write;
|
||||||
mod cli;
|
mod cli;
|
||||||
mod daemon;
|
mod daemon;
|
||||||
mod helper;
|
mod helper;
|
||||||
|
@ -46,6 +47,13 @@ fn main() -> Result<(), anyhow::Error> {
|
||||||
shell.generate(&mut Cli::command(), &mut std::io::stdout());
|
shell.generate(&mut Cli::command(), &mut std::io::stdout());
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
CliCommand::Manpage { file_path } => {
|
||||||
|
let man = clap_mangen::Man::new(Cli::command());
|
||||||
|
let mut buffer: Vec<u8> = Default::default();
|
||||||
|
man.render(&mut buffer)?;
|
||||||
|
std::fs::write(file_path, buffer)?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let answer = send_command(&args.socket, daemon_command)?;
|
let answer = send_command(&args.socket, daemon_command)?;
|
||||||
print!("{}", answer);
|
print!("{}", answer);
|
||||||
|
|
Loading…
Reference in New Issue