Skip to content

Commit

Permalink
WIP (issue lsd-rs#7)
Browse files Browse the repository at this point in the history
Gather flags for all files in a git directory (panic out of git directory).
  • Loading branch information
hpwxf committed Mar 1, 2021
1 parent 22f5a6b commit aca75ff
Show file tree
Hide file tree
Showing 15 changed files with 501 additions and 9 deletions.
184 changes: 184 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ xdg = "2.1.*"
yaml-rust = "0.4.*"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
log = { version = "0.4", features = ["release_max_level_warn"] }
git2 = "0.13"

[target.'cfg(unix)'.dependencies]
users = "0.11.*"

[target.'cfg(windows)'.dependencies]
winapi = {version = "0.3.*", features = ["aclapi", "accctrl", "winnt", "winerror", "securitybaseapi", "winbase"]}
winapi = { version = "0.3.*", features = ["aclapi", "accctrl", "winnt", "winerror", "securitybaseapi", "winbase"] }

[dependencies.clap]
features = ["suggestions", "color", "wrap_help"]
Expand Down
18 changes: 16 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,14 @@ pub fn build() -> App<'static, 'static> {
"name",
"inode",
"links",
"git_status",
])
.help("Specify the blocks that will be displayed and in what order"),
)
.arg(
Arg::with_name("classic")
.long("classic")
.help("Enable classic mode (no colors or icons)"),
.long("classic")
.help("Enable classic mode (no colors or icons)"),
)
.arg(
Arg::with_name("no-symlink")
Expand Down Expand Up @@ -272,6 +273,19 @@ pub fn build() -> App<'static, 'static> {
.multiple(true)
.help("When showing file information for a symbolic link, show information for the file the link references rather than for the link itself"),
)
.arg(
Arg::with_name("git")
.long("git")
.multiple(true)
.number_of_values(1)
.value_name("mode")
.default_value("flat")
.possible_values(&[
"flat",
"recursive",
])
.help("Git status help ") // TODO
)
}

fn validate_date_argument(arg: String) -> Result<(), String> {
Expand Down
6 changes: 5 additions & 1 deletion src/config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::path::PathBuf;

use serde::Deserialize;

use crate::flags::git_status::GitStatus;
use std::fs;

const CONF_DIR: &str = "lsd";
Expand Down Expand Up @@ -40,6 +41,7 @@ pub struct Config {
pub no_symlink: Option<bool>,
pub total_size: Option<bool>,
pub symlink_arrow: Option<String>,
pub git_status: Option<GitStatus>,
}

#[derive(Eq, PartialEq, Debug, Deserialize)]
Expand Down Expand Up @@ -88,6 +90,7 @@ impl Config {
no_symlink: None,
total_size: None,
symlink_arrow: None,
git_status: None,
}
}

Expand Down Expand Up @@ -170,7 +173,7 @@ classic: false
# == Blocks ==
# This specifies the columns and their order when using the long and the tree
# layout.
# Possible values: permission, user, group, size, size_value, date, name, inode
# Possible values: permission, user, group, size, size_value, date, name, inode, git_status
blocks:
- permission
- user
Expand Down Expand Up @@ -336,6 +339,7 @@ mod tests {
no_symlink: Some(false),
total_size: Some(false),
symlink_arrow: Some("⇒".into()),
git_status: None,
},
c
);
Expand Down
Loading

0 comments on commit aca75ff

Please sign in to comment.