-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from solidiquis/multi-config
Support multiple configs with `.erdtree.toml`
- Loading branch information
Showing
17 changed files
with
905 additions
and
206 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
icons = true | ||
human = true | ||
|
||
# Compute file sizes like `du` | ||
[du] | ||
disk_usage = "block" | ||
icons = true | ||
layout = "flat" | ||
no-ignore = true | ||
no-git = true | ||
hidden = true | ||
level = 1 | ||
|
||
# Do as `ls -l` | ||
[ls] | ||
icons = true | ||
human = true | ||
level = 1 | ||
suppress-size = true | ||
long = true | ||
|
||
# How many lines of Rust are in this code base? | ||
[rs] | ||
disk-usage = "word" | ||
level = 1 | ||
pattern = "\\.rs$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Long argument | ||
--icons | ||
--human | ||
|
||
# or short argument | ||
-l | ||
|
||
# args can be passed like this | ||
-d logical |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const ERDTREE_CONFIG_TOML: &str = ".erdtree.toml"; | ||
const ERDTREE_TOML_PATH: &str = "ERDTREE_TOML_PATH"; | ||
|
||
const ERDTREE_CONFIG_NAME: &str = ".erdtreerc"; | ||
const ERDTREE_CONFIG_PATH: &str = "ERDTREE_CONFIG_PATH"; | ||
|
||
const ERDTREE_DIR: &str = "erdtree"; | ||
|
||
#[cfg(unix)] | ||
const CONFIG_DIR: &str = ".config"; | ||
|
||
#[cfg(unix)] | ||
const HOME: &str = "HOME"; | ||
|
||
#[cfg(unix)] | ||
const XDG_CONFIG_HOME: &str = "XDG_CONFIG_HOME"; | ||
|
||
/// Concerned with loading `.erdtreerc`. | ||
pub mod rc; | ||
|
||
/// Concerned with loading `.erdtree.toml`. | ||
pub mod toml; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use config::ConfigError; | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
pub enum Error { | ||
#[error("Failed to load .erdtree.toml")] | ||
LoadConfig, | ||
|
||
#[error("The configuration file is improperly formatted")] | ||
InvalidFormat(#[from] ConfigError), | ||
|
||
#[error("Named table '{0}' was not found in '.erdtree.toml'")] | ||
MissingAltConfig(String), | ||
|
||
#[error("'#{0}' is required to be a pointer-sized unsigned integer type")] | ||
InvalidInteger(String), | ||
|
||
#[error("'#{0}' has a type that is invalid")] | ||
InvalidArgument(String), | ||
} |
Oops, something went wrong.