Преглед изворни кода

Merge branch 'main' into dependabot/github_actions/actions/stale-8

sbatial пре 2 година
родитељ
комит
0f2e2c4a1a

+ 7 - 3
.github/ISSUE_TEMPLATE/bug_report.md

@@ -1,11 +1,15 @@
 ---
 name: Bug report
-about: Report a crash, runtime error, or invalid output in exa
+about: Report a crash, runtime error, or invalid output in eza
+title: 'bug: '
+labels: errors
+assignees: ''
+
 ---
 
-If exa does something unexpected, or its output looks wrong, or it displays an error on the screen, or if it outright crashes, then please include the following information in your report:
+If eza does something unexpected, or its output looks wrong, or it displays an error on the screen, or if it outright crashes, then please include the following information in your report:
 
-- The version of exa being used (`exa --version`)
+- The version of eza being used (`eza --version`)
 - The command-line arguments you are using
 - Your operating system and hardware platform
 

+ 7 - 3
.github/ISSUE_TEMPLATE/compilation_error.md

@@ -1,11 +1,15 @@
 ---
 name: Compilation error
-about: Report a problem compiling exa
+about: Report a problem compiling eza
+title: 'ci: '
+labels: ''
+assignees: ''
+
 ---
 
-If exa fails to compile, or if there is a problem during the build process, then please include the following information in your report:
+If eza fails to compile, or if there is a problem during the build process, then please include the following information in your report:
 
-- The exact exa commit you are building (`git rev-parse --short HEAD`)
+- The exact eza commit you are building (`git rev-parse --short HEAD`)
 - The version of rustc you are compiling it with (`rustc --version`)
 - Your operating system and hardware platform
 - The Rust build target (the _exact_ output of `rustc --print cfg`)

+ 7 - 1
.github/ISSUE_TEMPLATE/feature_request.md

@@ -1,4 +1,10 @@
 ---
 name: Feature request
-about: Request a feature or enhancement to exa
+about: Request a feature or enhancement to eza
+title: 'feat:  '
+labels: ''
+assignees: ''
+
 ---
+
+

+ 7 - 1
.github/ISSUE_TEMPLATE/question.md

@@ -1,4 +1,10 @@
 ---
 name: Question
-about: Ask a question about exa
+about: Ask a question about eza
+title: ''
+labels: question
+assignees: ''
+
 ---
+
+This should be posted in Q&A in discussions

+ 87 - 0
CHANGELOG.md

@@ -2,6 +2,89 @@
 
 All notable changes to this project will be documented in this file.
 
+## [0.10.7] - 2023-08-13
+
+### Bug Fixes
+
+- Broken zsh completion syntax
+- Respect GIT_CEILING_DIRECTORIES
+- MacOS flake support
+
+### Documentation
+
+- Create SECURITY.md
+- Create CONTRIBUTING.md
+
+### Features
+
+- Add gitlab-ci.yml
+- Improve icon for Earthfile
+- Better.ps1, add .psd1, .psm1 icons
+- Replace .bat icon by windows cli icon
+- Use TeX icons and add .bib, .bst icon
+- Use Ocaml logo, add .mli, .mll, .mly
+- Add many more icons
+- Add -w/--width to help string
+- Add -w/--width to README
+- Add -w/--width to flags
+- Add -w/--width to manpage
+- Fish -w/--width
+- Zsh -w/--width
+
+### Miscellaneous Tasks
+
+- Add PR template
+- Bump log from 0.4.14 to 0.4.20
+
+### Refactor
+
+- GIT_DIR handling
+- Turn unused var into value
+- Fix borrowed trait implements required
+- Simplify format strings
+- Consistent style
+- Clippy::explicit_auto_deref
+- Clippy::explicit_auto_deref
+- Clippy::redundant_else
+- Clippy::manual_map
+- Clippy::semicolon_if_nothing_returned
+- Clippy::extra_unused_lifetimes
+- Allow clippy::wildcard_in_or_patterns
+- Clippy::uninlined_format_args
+- Allow Colours::new call with self
+- Clippy::explicit_iter_loop
+- Clippy::uninlined_format_args
+- Clippy::needless_late_init
+- Clippy::useless_conversion
+- Clippy::implicit_clone
+- Clippy::uninlined_format_args
+- Clippy::into-iter-on-ref
+- Clippy::semicolon_if_nothing_returned
+- Clippy::into_iter_on_ref
+- Clippy::needless_lifetimes
+- Clippy::uninlined_format_args
+- Trivial clippy lints
+- Clippy::semicolon_if_nothing_returned
+- Clippy::semicolon_if_nothing_returned
+- Clippy::manual_let_else
+- Clippy::semicolon_if_nothing_returned
+- Clippy::semicolon_if_nothing_returned
+- Clippy::uninlined_format_args
+- Clippy::manual_let_else
+- Clippy::manual_let_else
+- Clippy::manual_let_else
+- Clippy::manual_let_else
+- Clippy::manual_let_else
+- Fix trivial cast
+- Clippy::needless-borrow
+- TerminalWidth::deduce to -w/--width
+
+### Ci
+
+- Create pull_request_template.md
+- Add clippy check
+- Add dependabot updater
+
 ## [0.10.6] - 2023-08-07
 
 ### Bug Fixes
@@ -19,6 +102,10 @@ All notable changes to this project will be documented in this file.
 - Use GIT_DIR env var to find the repo
 - Add color explanations
 
+### Miscellaneous Tasks
+
+- Release 0.10.6
+
 ## [0.10.5] - 2023-08-03
 
 ### Bug Fixes

+ 1 - 1
Cargo.lock

@@ -53,7 +53,7 @@ dependencies = [
 
 [[package]]
 name = "eza"
-version = "0.10.6"
+version = "0.10.7"
 dependencies = [
  "ansi_term",
  "datetime",

+ 1 - 1
Cargo.toml

@@ -10,7 +10,7 @@ readme = "README.md"
 homepage = "https://github.com/cafkafk/eza"
 license = "MIT"
 repository = "https://github.com/cafkafk/eza"
-version = "0.10.6"
+version = "0.10.7"
 
 
 [[bin]]

+ 1 - 0
README.md

@@ -131,6 +131,7 @@ eza’s options are almost, but not quite, entirely unlike `ls`’s.
 - **--icons**: display icons
 - **--no-icons**: don't display icons (always overrides --icons)
 - **--hyperlink**: display entries as hyperlinks
+- **-w**, **--width=(columns)**: set screen width in columns
 
 ### Filtering options
 

+ 1 - 0
completions/fish/eza.fish

@@ -28,6 +28,7 @@ complete -c eza -l git-ignore -d "Ignore files mentioned in '.gitignore'"
 complete -c eza -s a -l all -d "Show hidden and 'dot' files"
 complete -c eza -s d -l list-dirs -d "List directories like regular files"
 complete -c eza -s L -l level -d "Limit the depth of recursion" -x -a "1 2 3 4 5 6 7 8 9"
+complete -c eza -s w -l width -d "Limits column output of grid, 0 implies auto-width" 
 complete -c eza -s r -l reverse -d "Reverse the sort order"
 complete -c eza -s s -l sort -d "Which field to sort by" -x -a "
     accessed\t'Sort by file accessed time'

+ 1 - 0
completions/zsh/_eza

@@ -30,6 +30,7 @@ __eza() {
         {-d,--list-dirs}"[List directories like regular files]" \
         {-D,--only-dirs}"[List only directories]" \
         {-L,--level}"+[Limit the depth of recursion]" \
+        {-w,--width}"+[Limits column output of grid, 0 implies auto-width]" \
         {-r,--reverse}"[Reverse the sort order]" \
         {-s,--sort}="[Which field to sort by]:(sort field):(accessed age changed created date extension Extension filename Filename inode modified oldest name Name newest none size time type)" \
         {-I,--ignore-glob}"[Ignore files that match these glob patterns]" \

+ 4 - 1
man/eza.1.md

@@ -78,6 +78,9 @@ Valid settings are ‘`always`’, ‘`automatic`’, and ‘`never`’.
 `--hyperlink`
 : Display entries as hyperlinks
 
+`-w`, `--width=COLS`
+Set screen width in columns.
+
 
 FILTERING AND SORTING OPTIONS
 =============================
@@ -204,7 +207,7 @@ eza responds to the following environment variables:
 
 ## `COLUMNS`
 
-Overrides the width of the terminal, in characters.
+Overrides the width of the terminal, in characters, however, `-w` takes precedence.
 
 For example, ‘`COLUMNS=80 eza`’ will show a grid view with a maximum width of 80 characters.
 

+ 2 - 1
src/options/flags.rs

@@ -14,6 +14,7 @@ pub static RECURSE:     Arg = Arg { short: Some(b'R'), long: "recurse",     take
 pub static TREE:        Arg = Arg { short: Some(b'T'), long: "tree",        takes_value: TakesValue::Forbidden };
 pub static CLASSIFY:    Arg = Arg { short: Some(b'F'), long: "classify",    takes_value: TakesValue::Forbidden };
 pub static DEREF_LINKS: Arg = Arg { short: Some(b'X'), long: "dereference", takes_value: TakesValue::Forbidden };
+pub static WIDTH:       Arg = Arg { short: Some(b'w'), long: "width",       takes_value: TakesValue::Necessary(None) };
 
 pub static COLOR:  Arg = Arg { short: None, long: "color",  takes_value: TakesValue::Necessary(Some(COLOURS)) };
 pub static COLOUR: Arg = Arg { short: None, long: "colour", takes_value: TakesValue::Necessary(Some(COLOURS)) };
@@ -77,7 +78,7 @@ pub static ALL_ARGS: Args = Args(&[
     &VERSION, &HELP,
 
     &ONE_LINE, &LONG, &GRID, &ACROSS, &RECURSE, &TREE, &CLASSIFY, &DEREF_LINKS,
-    &COLOR, &COLOUR, &COLOR_SCALE, &COLOUR_SCALE,
+    &COLOR, &COLOUR, &COLOR_SCALE, &COLOUR_SCALE, &WIDTH,
 
     &ALL, &ALMOST_ALL, &LIST_DIRS, &LEVEL, &REVERSE, &SORT, &DIRS_FIRST,
     &IGNORE_GLOB, &GIT_IGNORE, &ONLY_DIRS,

+ 1 - 0
src/options/help.rs

@@ -25,6 +25,7 @@ DISPLAY OPTIONS
   --icons            display icons
   --no-icons         don't display icons (always overrides --icons)
   --hyperlink        display entries as hyperlinks
+  -w, --width COLS   set screen width in columns
 
 FILTERING AND SORTING OPTIONS
   -a, --all                  show hidden and 'dot' files

+ 19 - 3
src/options/view.rs

@@ -11,7 +11,7 @@ use crate::output::time::TimeFormat;
 impl View {
     pub fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
         let mode = Mode::deduce(matches, vars)?;
-        let width = TerminalWidth::deduce(vars)?;
+        let width = TerminalWidth::deduce(matches, vars)?;
         let file_style = FileStyle::deduce(matches, vars)?;
         let deref_links = matches.has(&flags::DEREF_LINKS)?;
         Ok(Self { mode, width, file_style, deref_links })
@@ -145,10 +145,26 @@ impl details::Options {
 
 
 impl TerminalWidth {
-    fn deduce<V: Vars>(vars: &V) -> Result<Self, OptionsError> {
+    fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
         use crate::options::vars;
 
-        if let Some(columns) = vars.get(vars::COLUMNS).and_then(|s| s.into_string().ok()) {
+        if let Some(width) = matches.get(&flags::WIDTH)? {
+            let arg_str = width.to_string_lossy();
+            match arg_str.parse() {
+                Ok(w) => {
+                    if w >= 1 {
+                        Ok(Self::Set(w))
+                    } else {
+                        Ok(Self::Automatic)
+                    }
+                }
+                Err(e) => {
+                    let source = NumberSource::Arg(&flags::WIDTH);
+                    Err(OptionsError::FailedParse(arg_str.to_string(), source, e))
+                }
+            }
+        }
+        else if let Some(columns) = vars.get(vars::COLUMNS).and_then(|s| s.into_string().ok()) {
             match columns.parse() {
                 Ok(width) => {
                     Ok(Self::Set(width))

+ 49 - 8
src/output/icons.rs

@@ -72,9 +72,10 @@ lazy_static! {
         m.insert("config", '\u{e5fc}'); // 
         m.insert("docker-compose.yml", '\u{f308}'); // 
         m.insert("Dockerfile", '\u{f308}'); // 
-        m.insert("Earthfile", '\u{f30d}'); // 🌍
+        m.insert("Earthfile", '\u{f0ac}'); // 
         m.insert("ds_store", '\u{f179}'); // 
         m.insert("gitignore_global", '\u{f1d3}'); // 
+        m.insert("gitlab-ci.yml", '\u{f296}'); // 
         m.insert("go.mod", '\u{e626}'); // 
         m.insert("go.sum", '\u{e626}'); // 
         m.insert("gradle", '\u{e256}'); // 
@@ -115,10 +116,14 @@ pub fn icon_for_file(file: &File<'_>) -> char {
     else if let Some(icon) = extensions.icon_file(file) { icon }
     else if let Some(ext) = file.ext.as_ref() {
         match ext.as_str() {
+            "7z"            => '\u{f410}', // 
+            "a"             => '\u{f17c}', // 
+            "acf"           => '\u{f1b6}', // 
             "ai"            => '\u{e7b4}', // 
             "android"       => '\u{e70e}', // 
             "apk"           => '\u{e70e}', // 
             "apple"         => '\u{f179}', // 
+            "asm"           => '\u{e637}', // 
             "avi"           => '\u{f03d}', // 
             "avif"          => '\u{f1c5}', // 
             "avro"          => '\u{e60b}', // 
@@ -127,27 +132,33 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "bash_history"  => '\u{f489}', // 
             "bash_profile"  => '\u{f489}', // 
             "bashrc"        => '\u{f489}', // 
-            "bat"           => '\u{f17a}', // 
+            "bat"           => '\u{ebc4}', //  
             "bats"          => '\u{f489}', // 
+            "bib"           => '\u{e69b}', // 
+            "bin"           => '\u{eae8}', // 
             "bmp"           => '\u{f1c5}', // 
+            "bst"           => '\u{e69b}', // 
             "bz"            => '\u{f410}', // 
             "bz2"           => '\u{f410}', // 
             "c"             => '\u{e61e}', // 
             "c++"           => '\u{e61d}', // 
             "cab"           => '\u{e70f}', // 
             "cc"            => '\u{e61d}', // 
+            "cert"          => '\u{eafa}', // 
             "cfg"           => '\u{e615}', // 
             "cjs"           => '\u{e74e}', // 
             "class"         => '\u{e256}', // 
             "clj"           => '\u{e768}', // 
             "cljs"          => '\u{e76a}', // 
-            "cls"           => '\u{f034}', // 
+            "cls"           => '\u{e69b}', // 
             "cmd"           => '\u{e70f}', // 
             "coffee"        => '\u{f0f4}', // 
             "conf"          => '\u{e615}', // 
+            "config"        => '\u{e615}', // 
             "cp"            => '\u{e61d}', // 
             "cpio"          => '\u{f410}', // 
             "cpp"           => '\u{e61d}', // 
+            "crt"           => '\u{eafa}', // 
             "cs"            => '\u{f031b}', // 󰌛
             "csh"           => '\u{f489}', // 
             "cshtml"        => '\u{f1fa}', // 
@@ -156,16 +167,19 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "csv"           => '\u{f1c3}', // 
             "csx"           => '\u{f031b}', // 󰌛
             "cts"           => '\u{e628}', // 
+            "cu"            => '\u{e64b}', // 
             "cxx"           => '\u{e61d}', // 
             "d"             => '\u{e7af}', // 
             "dart"          => '\u{e798}', // 
             "db"            => '\u{f1c0}', // 
             "deb"           => '\u{e77d}', // 
+            "desktop"       => '\u{ebd1}', // 
             "diff"          => '\u{f440}', // 
             "djvu"          => '\u{f02d}', // 
             "dll"           => '\u{e70f}', // 
             "doc"           => '\u{f1c2}', // 
             "docx"          => '\u{f1c2}', // 
+            "drawio"        => '\u{ebba}', // 
             "ds_store"      => '\u{f179}', // 
             "DS_store"      => '\u{f179}', // 
             "dump"          => '\u{f1c0}', // 
@@ -175,6 +189,7 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "ejs"           => '\u{e618}', // 
             "el"            => '\u{e632}', // 
             "elm"           => '\u{e62c}', // 
+            "eml"           => '\u{f003}', //  
             "env"           => '\u{f462}', // 
             "eot"           => '\u{f031}', // 
             "epub"          => '\u{e28a}', // 
@@ -215,7 +230,11 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "htm"           => '\u{f13b}', // 
             "html"          => '\u{f13b}', // 
             "hxx"           => '\u{f0fd}', // 
+            "ical"          => '\u{eab0}', // 
+            "icalendar"     => '\u{eab0}', // 
             "ico"           => '\u{f1c5}', // 
+            "ics"           => '\u{eab0}', // 
+            "ifb"           => '\u{eab0}', // 
             "image"         => '\u{f1c5}', // 
             "img"           => '\u{e271}', // 
             "iml"           => '\u{e7b5}', // 
@@ -241,8 +260,12 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "json"          => '\u{e60b}', // 
             "jsx"           => '\u{e7ba}', // 
             "jxl"           => '\u{f1c5}', // 
+            "kdb"           => '\u{f23e}', // 
+            "kdbx"          => '\u{f23e}', // 
+            "key"           => '\u{eb11}', // 
+            "ko"            => '\u{f17c}', // 
             "ksh"           => '\u{f489}', // 
-            "latex"         => '\u{f034}', // 
+            "latex"         => '\u{e69b}', // 
             "less"          => '\u{e758}', // 
             "lhs"           => '\u{e777}', // 
             "license"       => '\u{f02d}', // 
@@ -256,9 +279,13 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "lzma"          => '\u{f410}', // 
             "lzo"           => '\u{f410}', // 
             "m"             => '\u{e61e}', // 
-            "ml"            => '\u{1d77a}',// 𝝺
+            "ml"            => '\u{e67a}', // 
+            "mli"           => '\u{e67a}', // 
+            "mll"           => '\u{e67a}', // 
+            "mly"           => '\u{e67a}', // 
             "mm"            => '\u{e61d}', // 
             "m4a"           => '\u{f001}', // 
+            "magnet"        => '\u{f076}', // 
             "markdown"      => '\u{f48a}', // 
             "md"            => '\u{f48a}', // 
             "mjs"           => '\u{e74e}', // 
@@ -276,6 +303,7 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "nix"           => '\u{f313}', // 
             "node"          => '\u{f0399}', // 󰎙
             "npmignore"     => '\u{e71e}', // 
+            "o"             => '\u{eae8}', // 
             "odp"           => '\u{f1c4}', // 
             "ods"           => '\u{f1c3}', // 
             "odt"           => '\u{f1c2}', // 
@@ -283,9 +311,11 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "ogv"           => '\u{f03d}', // 
             "org"           => '\u{e633}', // 
             "otf"           => '\u{f031}', // 
+            "out"           => '\u{eb2c}', // 
             "part"          => '\u{f43a}', // 
             "patch"         => '\u{f440}', // 
             "pdf"           => '\u{f1c1}', // 
+            "pem"           => '\u{eb11}', // 
             "php"           => '\u{e73d}', // 
             "pl"            => '\u{e769}', // 
             "plx"           => '\u{e769}', // 
@@ -296,11 +326,14 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "pptx"          => '\u{f1c4}', // 
             "procfile"      => '\u{e21e}', // 
             "properties"    => '\u{e60b}', // 
-            "ps1"           => '\u{f489}', // 
+            "ps1"           => '\u{ebc7}', //  
             "psd"           => '\u{e7b8}', // 
+            "psd1"          => '\u{ebc7}', //  
+            "psm1"          => '\u{ebc7}', //  
             "pxm"           => '\u{f1c5}', // 
             "py"            => '\u{e606}', // 
             "pyc"           => '\u{e606}', // 
+            "qcow2"         => '\u{e271}', // 
             "r"             => '\u{f25d}', // 
             "rakefile"      => '\u{e21e}', // 
             "rar"           => '\u{f410}', // 
@@ -324,9 +357,11 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "rtf"           => '\u{f0219}', // 󰈙
             "ru"            => '\u{e21e}', // 
             "rubydoc"       => '\u{e73b}', // 
+            "s"             => '\u{e637}', // 
             "sass"          => '\u{e603}', // 
             "scala"         => '\u{e737}', // 
             "scss"          => '\u{e749}', // 
+            "service"       => '\u{eba2}', // 
             "sh"            => '\u{f489}', // 
             "shell"         => '\u{f489}', // 
             "slim"          => '\u{e73b}', // 
@@ -334,7 +369,7 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "so"            => '\u{f17c}', // 
             "sql"           => '\u{f1c0}', // 
             "sqlite3"       => '\u{e7c4}', // 
-            "sty"           => '\u{f034}', // 
+            "sty"           => '\u{e69b}', // 
             "styl"          => '\u{e600}', // 
             "stylus"        => '\u{e600}', // 
             "svg"           => '\u{f1c5}', // 
@@ -344,7 +379,7 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "taz"           => '\u{f410}', // 
             "tbz"           => '\u{f410}', // 
             "tbz2"          => '\u{f410}', // 
-            "tex"           => '\u{f034}', // 
+            "tex"           => '\u{e69b}', // 
             "tgz"           => '\u{f410}', // 
             "tiff"          => '\u{f1c5}', // 
             "tlz"           => '\u{f410}', // 
@@ -359,8 +394,13 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "txz"           => '\u{f410}', // 
             "tz"            => '\u{f410}', // 
             "tzo"           => '\u{f410}', // 
+            "unity"         => '\u{e721}', // 
+            "unity3d"       => '\u{e721}', // 
+            "vdi"           => '\u{e271}', // 
+            "vhd"           => '\u{e271}', // 
             "video"         => '\u{f03d}', // 
             "vim"           => '\u{e7c5}', // 
+            "vmdk"          => '\u{e271}', // 
             "vue"           => '\u{f0844}', // 󰡄
             "war"           => '\u{e256}', // 
             "wav"           => '\u{f001}', // 
@@ -371,6 +411,7 @@ pub fn icon_for_file(file: &File<'_>) -> char {
             "woff2"         => '\u{f031}', // 
             "xhtml"         => '\u{f13b}', // 
             "xls"           => '\u{f1c3}', // 
+            "xlsm"          => '\u{f1c3}', // 
             "xlsx"          => '\u{f1c3}', // 
             "xml"           => '\u{f05c0}', // 󰗀
             "xul"           => '\u{f05c0}', // 󰗀