dduan / tre

Tree command, improved.
MIT License
732 stars 15 forks source link

-e flag error #122

Closed waciumawanjohi closed 1 year ago

waciumawanjohi commented 1 year ago

Running tre with the -e flag produces an error.

Setup

Mac OS Monterey zsh shell oh-my-zsh installed tre installed via brew brew install tre-command .zshrc includes the following line

tre() { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; }

Command

tre -e vim

Expected

Command exits successfully Running the command

alias | grep e0

gives the result

e0='eval '\''vim "."'\'

Actual

Command exits with code 2 Stderr output:

error: The argument '--editor [<COMMAND>]' was provided more than once, but cannot be used multiple times

USAGE:
    tre [OPTIONS] [PATH]

For more information try --help

No alias created

dduan commented 1 year ago

Hello, the zsh function already includes -e. When you type tre in the shell, it's actually calling the function, which then calls the actual tre command. Long story short, you don't need to include -e vim when you use tre in command line.

If you don't have your EDITOR environment variable set to vim already, you can replace the shell config with

tre() { command tre "$@" -e vim && source "/tmp/tre_aliases_$USER" 2>/dev/null; }

(note the vim part after -e)

... to ensure Vim is in the alias.