Cleanup
This commit is contained in:
parent
ab77d39ee0
commit
293da4f330
3 changed files with 6 additions and 32 deletions
28
build.rs
28
build.rs
|
@ -1,39 +1,19 @@
|
||||||
use clap::{Command, CommandFactory};
|
use clap::CommandFactory;
|
||||||
// use clap_complete as complete;
|
use clap_mangen::generate_to;
|
||||||
use clap_mangen as mangen;
|
|
||||||
// use complete::Shell;
|
|
||||||
use std::{path::PathBuf, str::FromStr};
|
|
||||||
|
|
||||||
#[path = "src/cli.rs"]
|
#[path = "src/cli.rs"]
|
||||||
mod cli;
|
mod cli;
|
||||||
|
|
||||||
use cli::*;
|
use cli::*;
|
||||||
|
|
||||||
fn generate_manpage(cmd: Command, out_dir: PathBuf) -> std::io::Result<()> {
|
|
||||||
let _path = mangen::generate_to(cmd, &out_dir)?;
|
|
||||||
println!("cargo:warning=manpage is generated: {out_dir:?}");
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
// fn generate_completions(cmd: &mut Command, out_dir: PathBuf) -> std::io::Result<()> {
|
|
||||||
// let path = complete::generate_to(Shell::Zsh, cmd, "noise", out_dir)?;
|
|
||||||
// println!("cargo:warning=completion file is generated: {path:?}");
|
|
||||||
// Ok(())
|
|
||||||
// }
|
|
||||||
|
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
let out_dir =
|
let out_dir =
|
||||||
std::path::PathBuf::from(std::env::var_os("OUT_DIR").ok_or(std::io::ErrorKind::NotFound)?);
|
std::path::PathBuf::from(std::env::var_os("OUT_DIR").ok_or(std::io::ErrorKind::NotFound)?);
|
||||||
|
|
||||||
// let out_dir = PathBuf::from_str("./").unwrap();
|
|
||||||
|
|
||||||
let cmd = Cli::command();
|
let cmd = Cli::command();
|
||||||
|
|
||||||
generate_manpage(cmd, out_dir.clone())?;
|
generate_to(cmd, &out_dir)?;
|
||||||
|
println!("cargo:warning=OUT_DIR: {out_dir:?}");
|
||||||
// eprintln!("{out_dir:?}");
|
|
||||||
// println!("cargo:warning=out_dir: {out_dir:?}");
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{
|
{
|
||||||
self,
|
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
utils,
|
utils,
|
||||||
naersk,
|
naersk,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (
|
utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
|
@ -32,10 +32,6 @@
|
||||||
postInstall =
|
postInstall =
|
||||||
with pkgs;
|
with pkgs;
|
||||||
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||||
# installShellCompletion --cmd noise \
|
|
||||||
# --bash <($out/bin/fd --generate-completions bash) \
|
|
||||||
# --fish <($out/bin/fd --generate-completions fish)
|
|
||||||
# installShellCompletion --zsh contrib/completion/_fd
|
|
||||||
installShellCompletion --cmd noise \
|
installShellCompletion --cmd noise \
|
||||||
--bash <($out/bin/noise --generate-completions bash) \
|
--bash <($out/bin/noise --generate-completions bash) \
|
||||||
--zsh <($out/bin/noise --generate-completions zsh) \
|
--zsh <($out/bin/noise --generate-completions zsh) \
|
||||||
|
|
|
@ -25,14 +25,12 @@ pub struct Cli {
|
||||||
/// Generate shell completions
|
/// Generate shell completions
|
||||||
#[arg(long = "generate-completions", value_enum)]
|
#[arg(long = "generate-completions", value_enum)]
|
||||||
pub completions: Option<Shell>,
|
pub completions: Option<Shell>,
|
||||||
// /// Generate manpage
|
|
||||||
// #[arg(long = "generate-manpage", value_enum)]
|
|
||||||
// pub manpage: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand, Debug, PartialEq)]
|
#[derive(Subcommand, Debug, PartialEq)]
|
||||||
pub enum Commands {
|
pub enum Commands {
|
||||||
/// Toggle MPD playback
|
/// Toggle MPD playback
|
||||||
|
#[command(visible_alias = "t")]
|
||||||
Toggle,
|
Toggle,
|
||||||
/// Skip to the next track
|
/// Skip to the next track
|
||||||
#[command(visible_alias = "skip")]
|
#[command(visible_alias = "skip")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue