diff --git a/CHANGELOG.md b/CHANGELOG.md index 7db472f..225e2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,18 @@ All notable changes to this project will be documented in this file. +## [2025.1 (pending)] +### Added +- add implied . and .. folders to -a option +- almost all option (-A) + ## [2024.6] ### Added - , (comma) flag to print file sizes grouped and separated by thousands. +- --ignore-case option -### Update -- icons +### Updated +- updated icons ## [2024.5] ### Added diff --git a/lsv/format.v b/lsv/format.v index 3063623..8dcf171 100644 --- a/lsv/format.v +++ b/lsv/format.v @@ -11,7 +11,18 @@ enum Align { right } -fn print_files(entries []Entry, options Options) { +fn print_files(entries_arg []Entry, options Options) { + entries := match true { + options.all && !options.almost_all { + dot := make_entry('.', '.', options) + dot_dot := make_entry('..', '.', options) + arrays.concat([dot, dot_dot], ...entries_arg) + } + else { + entries_arg + } + } + w, _ := term.get_terminal_size() options_width_ok := options.width_in_cols > 0 && options.width_in_cols < 1000 width := if options_width_ok { options.width_in_cols } else { w } diff --git a/lsv/format_long.v b/lsv/format_long.v index 4a19852..e64f000 100644 --- a/lsv/format_long.v +++ b/lsv/format_long.v @@ -330,15 +330,20 @@ fn statistics(entries []Entry, len int, options Options) { size := match true { // vfmt off + options.size_comma { num_with_commas(total) } options.size_ki { readable_size(total, true) } options.size_kb { readable_size(total, false) } - options.size_comma { num_with_commas(total) + ' bytes' } else { total.str() } // vfmt on } totals := style_string(size, options.style_fi, options) - stats = '${dir_count_styled} ${dirs} | ${file_count_styled} ${files} | ${totals}' + totals_units := if !options.size_ki && !options.size_kb { + style_string('bytes', dim, options) + } else { + '' + } + stats = '${dir_count_styled} ${dirs} | ${file_count_styled} ${files} | ${totals} ${totals_units}' if link_count > 0 { link_count_styled := style_string(link_count.str(), options.style_ln, options) diff --git a/lsv/options.v b/lsv/options.v index 395b43f..61030d1 100644 --- a/lsv/options.v +++ b/lsv/options.v @@ -25,6 +25,7 @@ struct Options { // // filter, group and sorting options all bool + almost_all bool dirs_first bool only_dirs bool only_files bool @@ -84,6 +85,7 @@ fn parse_args(args []string) Options { fp.arguments_description('[FILES]') all := fp.bool('', `a`, false, 'include files starting with .') + almost_all := fp.bool('', `A`, false, 'do not list implied . and ..') colorize := fp.bool('', `c`, false, 'color the listing') dir_indicator := fp.bool('', `D`, false, 'append / to directories') icons := fp.bool('', `i`, false, 'show file icon (requires nerd fonts)') @@ -115,8 +117,8 @@ fn parse_args(args []string) Options { size_kb := fp.bool('', `K`, false, 'sizes in Kilobytes (1000) (e.g. 1kb 234mb 2gb)') octal_permissions := fp.bool('', `o`, false, 'show octal permissions') relative_path := fp.bool('', `p`, false, 'show relative path') - accessed_date := fp.bool('', `A`, false, 'show last accessed date') changed_date := fp.bool('', `C`, false, 'show last status changed date') + accessed_date := fp.bool('', `E`, false, 'show last accessed date') header := fp.bool('', `H`, false, 'show column headers') time_iso := fp.bool('', `I`, false, 'show time in iso format') time_compact := fp.bool('', `J`, false, 'show time in compact format') @@ -145,6 +147,7 @@ fn parse_args(args []string) Options { return Options{ all: all + almost_all: almost_all accessed_date: accessed_date blocked_output: blocked_output changed_date: changed_date