1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
//! Macros for supporting command types /// Implement the `from_args` and `from_env_args` methods for a command // TODO: less hax way of doing this (move into `derive(Options)`?) #[macro_export] macro_rules! impl_command { ($command:tt) => { impl $crate::Command for $command { /// Name of this program as a string fn name() -> &'static str { env!("CARGO_PKG_NAME") } /// Description of this program fn description() -> &'static str { env!("CARGO_PKG_DESCRIPTION") } /// Version of this program fn version() -> &'static str { env!("CARGO_PKG_VERSION") } /// Authors of this program fn authors() -> &'static str { env!("CARGO_PKG_AUTHORS") } } }; }