| 1 |
//! Flags for each option (ARGPARSE_OPTS). The type code may be ORed |
| 2 |
//! with the OPT flags. |
| 3 |
|
| 4 |
/// Does not take an argument. |
| 5 |
pub const TYPE_NONE : u32 = 0; |
| 6 |
/// Takes an int argument. |
| 7 |
pub const TYPE_INT : u32 = 1; |
| 8 |
/// Takes a string argument. |
| 9 |
pub const TYPE_STRING : u32 = 2; |
| 10 |
/// Takes a long argument. |
| 11 |
pub const TYPE_LONG : u32 = 3; |
| 12 |
/// Takes an unsigned long argument. |
| 13 |
pub const TYPE_ULONG : u32 = 4; |
| 14 |
/// Argument is optional. |
| 15 |
pub const OPT_OPTIONAL : u32 = 1<< 3; |
| 16 |
/// Allow 0x etc. prefixed values. |
| 17 |
pub const OPT_PREFIX : u32 = 1<< 4; |
| 18 |
|
| 19 |
/// Ignore command or option. |
| 20 |
pub const OPT_IGNORE : u32 = 1<< 6; |
| 21 |
/// The argument is a command. |
| 22 |
pub const OPT_COMMAND : u32 = 1<< 7; |
| 23 |
/// The value is a conffile. |
| 24 |
pub const OPT_CONFFILE : u32 = 1<< 8; |
| 25 |
/// The value is printed as a header. |
| 26 |
pub const OPT_HEADER : u32 = 1<< 9; |
| 27 |
|
| 28 |
// Unused flags: |
| 29 |
|
| 30 |
//pub const OPT_VERBATIM : u32 = 1<<10; // The value is printed verbatim. |
| 31 |
//pub const ATTR_FORCE : u32 = 1<<14; // Attribute force is set. |
| 32 |
//pub const ATTR_IGNORE : u32 = 1<<15; // Attribute ignore is set. |
| 33 |
|
| 34 |
/// Returns the type bits for the given flags. |
| 35 |
pub fn flags_type(flags: u32) -> u32 { |
| 36 |
flags & 0b111 |
| 37 |
} |