Skip to content

Commit

Permalink
refactor: Flatten directory heirarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 10, 2022
1 parent fb9e4e7 commit 60a8747
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 29 deletions.
4 changes: 3 additions & 1 deletion src/build/app.rs
Expand Up @@ -16,7 +16,6 @@ use yaml_rust::Yaml;

// Internal
use crate::build::app_settings::{AppFlags, AppSettings};
use crate::build::debug_asserts::assert_app;
use crate::build::{arg::ArgProvider, Arg, ArgGroup, ArgPredicate};
use crate::error::ErrorKind;
use crate::error::Result as ClapResult;
Expand All @@ -26,6 +25,9 @@ use crate::parse::{ArgMatcher, ArgMatches, Input, Parser};
use crate::util::{color::ColorChoice, Id, Key};
use crate::{Error, INTERNAL_ERROR_MSG};

#[cfg(debug_assertions)]
use crate::build::debug_asserts::assert_app;

/// Build a command-line interface.
///
/// This includes defining arguments, subcommands, parser behavior, and help output.
Expand Down
29 changes: 8 additions & 21 deletions src/build/arg/mod.rs → src/build/arg.rs
@@ -1,15 +1,3 @@
mod arg_predicate;
mod possible_value;
mod settings;
#[cfg(test)]
mod tests;
mod value_hint;

pub use self::possible_value::PossibleValue;
pub use self::settings::{ArgFlags, ArgSettings};
pub use self::value_hint::ValueHint;
pub(crate) use arg_predicate::ArgPredicate;

// Std
use std::{
borrow::Cow,
Expand All @@ -27,17 +15,16 @@ use std::{env, ffi::OsString};
use yaml_rust::Yaml;

// Internal
use crate::{
build::usage_parser::UsageParser,
util::{Id, Key},
INTERNAL_ERROR_MSG,
};

#[cfg(feature = "regex")]
mod regex;
use crate::build::usage_parser::UsageParser;
use crate::build::ArgPredicate;
use crate::util::{Id, Key};
use crate::PossibleValue;
use crate::ValueHint;
use crate::INTERNAL_ERROR_MSG;
use crate::{ArgFlags, ArgSettings};

#[cfg(feature = "regex")]
pub use self::regex::RegexRef;
use crate::build::RegexRef;

/// The abstract representation of a command line argument. Used to set all the options and
/// relationships that define a valid argument for the program.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 20 additions & 5 deletions src/build/mod.rs
Expand Up @@ -6,16 +6,31 @@ pub mod arg;

mod app_settings;
mod arg_group;
mod arg_predicate;
mod arg_settings;
mod possible_value;
mod usage_parser;
mod value_hint;

#[cfg(feature = "regex")]
mod regex;

#[cfg(debug_assertions)]
mod debug_asserts;

#[cfg(test)]
mod app_tests;
#[cfg(test)]
mod arg_tests;

pub use app::App;
pub use app_settings::{AppFlags, AppSettings};
pub use arg::Arg;
pub use arg_group::ArgGroup;
pub(crate) use arg_predicate::ArgPredicate;
pub use arg_settings::{ArgFlags, ArgSettings};
pub use possible_value::PossibleValue;
pub use value_hint::ValueHint;

pub use self::app::App;
pub use self::app_settings::{AppFlags, AppSettings};
pub use self::arg::{Arg, ArgFlags, ArgSettings, PossibleValue, ValueHint};
pub use self::arg_group::ArgGroup;
pub(crate) use arg::ArgPredicate;
#[cfg(feature = "regex")]
pub use self::regex::RegexRef;
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -65,7 +65,7 @@ mod macros;
mod derive;

#[cfg(feature = "regex")]
pub use crate::build::arg::RegexRef;
pub use crate::build::RegexRef;

pub mod error;

Expand Down
2 changes: 1 addition & 1 deletion src/parse/validator.rs
@@ -1,5 +1,5 @@
// Internal
use crate::build::{arg::PossibleValue, App, AppSettings as AS, Arg, ArgPredicate};
use crate::build::{App, AppSettings as AS, Arg, ArgPredicate, PossibleValue};
use crate::error::{Error, Result as ClapResult};
use crate::output::Usage;
use crate::parse::{ArgMatcher, MatchedArg, ParseState, Parser};
Expand Down

0 comments on commit 60a8747

Please sign in to comment.