diff --git a/Cargo.toml b/Cargo.toml index c360204..8291a4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,11 +5,15 @@ edition = "2021" [dependencies] anyhow = "1.0" +cfg-if = "1.0.0" clap = { version = "4.5", features = ["derive"] } fasteval = "0.2.4" tinyaudio = { version = "0.1", optional = true } [features] +# default = [] +# default = ["save"] +# default = ["play"] default = ["play", "save"] play = ["dep:tinyaudio"] save = [] diff --git a/src/cli.rs b/src/cli.rs index 3cba449..e09a10b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,11 +1,12 @@ -use std::{ - fs::read_to_string, - ops::Deref, - path::{Path, PathBuf}, - str::FromStr, -}; +use std::{fs::read_to_string, ops::Deref, path::Path, str::FromStr}; +cfg_if! { + if #[cfg(save)] { + use std::path::PathBuf; + } +} use anyhow::{Context, Error}; +use cfg_if::cfg_if; use clap::Parser; #[derive(Parser)] @@ -13,8 +14,12 @@ use clap::Parser; pub(super) struct Args { #[arg(short, long, value_parser = Instrument::from_str)] instrument: Option, + #[cfg(save)] #[arg(short, long)] output: Option, + #[cfg(play)] + #[arg(short, long)] + silent: bool, score: Score, }