lamp 0.3.1

A Linux backlight utility inspired by acpibacklight
// This file is part of the "lamp" program.
//     Copyright (C) 2022  crapStone
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

use clap::{App, Arg};

pub fn build_cli() -> App<'static> {
    App::new("lamp")
        .version(env!("CARGO_PKG_VERSION"))
        .author("crapStone <crapstone01@gmail.com>")
        .about("Utility to interact with backlight")
        .global_setting(clap::AppSettings::ArgRequiredElseHelp)
        .arg(
            Arg::with_name("set")
                .short('s')
                .long("set")
                .help("Sets brightness to given value")
                .takes_value(true)
                .value_name("VALUE"),
        )
        .arg(
            Arg::with_name("inc")
                .short('i')
                .long("increase")
                .help("Increases brightness")
                .takes_value(true)
                .value_name("PERCENT"),
        )
        .arg(
            Arg::with_name("dec")
                .short('d')
                .long("decrease")
                .help("Decreases brightness")
                .takes_value(true)
                .value_name("PERCENT"),
        )
        .arg(
            Arg::with_name("get")
                .short('g')
                .long("get")
                .help("Prints current brightness value"),
        )
        .arg(
            Arg::with_name("zero")
                .short('z')
                .long("zero")
                .help("Sets brightness to lowest value"),
        )
        .arg(
            Arg::with_name("full")
                .short('f')
                .long("full")
                .help("Sets brightness to highest value"),
        )
        .arg(
            Arg::with_name("list")
                .short('l')
                .long("list")
                .help("Lists all devices with controllable brightness and led values")
                .exclusive(true),
        )
        .arg(
            Arg::with_name("controller")
                .short('c')
                .long("controller")
                .help("Select device to control, defaults to the first device found")
                .value_name("DEVICE")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("ctrl_type")
                .short('t')
                .long("type")
                .value_name("controller_type")
                .takes_value(true)
                .possible_values(&["raw", "lin", "log"])
                .default_value("lin")
                .help("choose controller type")
                .long_help(
                    r#"You can choose between these controller types:
raw: uses the raw values found in the device files
lin: uses percentage values (0.0 - 1.0) with a linear curve
log: uses percentage values (0.0 - 1.0) with a logarithmic curve
     the perceived brightness for the human eyes should be linear with this controller
"#,
                ),
        )
}