nomino icon indicating copy to clipboard operation
nomino copied to clipboard

Add a flag to select the printed format

Open juarezr opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

I loved nomino pragmatic approach to renaming files.

But I missing:

  • Printing output column aligned without table borders/headers/formating
  • Printing to markdown
  • Printing generated json to stdout

Describe the solution you'd like

Add some command-line options like:

USAGE:
    nomino [FLAGS] [OPTIONS] [[SOURCE] OUTPUT]...

FLAGS:
    -e, --extension    Preserves the extension of input files in 'sort' and 'regex' options
    -h, --help         Prints help information
    -k, --mkdir        Recursively creates all parent directories of '<OUTPUT>' if they are missing
    -w, --overwrite    Overwrites output files, otherwise, a '_' is prepended to filename
-    -p, --print        Prints the rename map as table to stdout
+    -p, --print        Prints the rename map as table to stdout
+    -l, --log          Prints the rename map as table to stderr
    -t, --test         Runs in test mode without renaming actual files (dry-run)
    -V, --version      Prints version information

OPTIONS:
        --depth <DEPTH>        Optional value to overwrite inferred subdirectory depth value in 'regex' mode
    -d, --dir <PATH>           Sets the working directory
    -g, --generate <PATH>      Stores a JSON map file in '<PATH>' after renaming files
+    -G, --gen-as [FMT]         Change stored file format to <FMT> [possible values: cols, csv, json, markdown, table]
+    -F, --format [FMT]         Change printed format to <FMT> [possible values: cols, csv, json, markdown, table]
    -m, --map <PATH>           Sets the path of map file to be used for renaming files
        --max-depth <DEPTH>    Optional value to set the maximum of subdirectory depth value in 'regex' mode
    -r, --regex <PATTERN>      Regex pattern (RE2 syntax) to match by filenames
    -s, --sort <ORDER>         Sets the order of natural sorting (by name) to rename files using enumerator [possible
                               values: ASC, DESC]

So command invocations like the bellow will print:

$ ls -l *.md
-rw-r--r--  1 root  root   4707 Jun 18 11:38 CODE_OF_CONDUCT.md
-rw-r--r--  1 root  root  10429 Jun 18 11:38 CONTRIBUTING.md
-rw-r--r--  1 root  root   4955 Jun 18 11:38 README.md
$$ nomino -pt -F cols '(.*)\.(md)' '{2}-{1}+{}'
CODE_OF_CONDUCT.md md-CODE_OF_CONDUCT+CODE_OF_CONDUCT
CONTRIBUTING.md    md-CONTRIBUTING+CONTRIBUTING      
README.md          md-README+README                  

juarezr avatar Jun 18 '21 15:06 juarezr