Closed TriMoon closed 1 year ago
Is this still work in progress?
Because of the previous error, i left it as a draft for you to check :wink:
Ill leave it as a Draft, so you can check it also before we create the final MR... (Feel free to change it from Draft to final MR)
cp
is working again :-)
I've run into troubles as well, the issue is that fasd (autojump) encourages to alias to f (see readme https://github.com/clvv/fasd).
Having an alias on f seems to break this.
I would propose renaming the functions to something more specific eg: mzcFunction
If that makes sense I'm happy to do a PR.
Thanks for an overall well polished config!
another proposal which might be cleaner:
alias cp='$(fo=${1:--i}; shift; echo cp $fo $*)' # Confirm before overwriting something
alias df='$(if test $# -eq 0;then opts=(-h);else opts=("$@");fi; echo df "$opts[@]")' # Human-readable sizes
alias free='$(if test $# -eq 0;then opts=(-m);else opts=("$@");fi; echo free "$opts[@]")' # Show sizes in MB
or something following a more conventional approach:
alias cp='_f(){fo=${1:--i}; shift; cp $fo $*; unset -f _f};_f' # Confirm before overwriting something
alias df='_f(){if test $# -eq 0;then opts=(-h);else opts=("$@");fi; df "$opts[@]"; unset -f _f};_f' # Human-readable sizes
alias free='_f(){if test $# -eq 0;then opts=(-m);else opts=("$@");fi; free "$opts[@]"; unset -f _f};_f' # Show sizes in MB
@McKean another proposal which might be cleaner:
alias cp='$(fo=${1:--i}; shift; echo cp $fo $*)' # Confirm before overwriting something alias df='$(if test $# -eq 0;then opts=(-h);else opts=("$@");fi; echo df "$opts[@]")' # Human-readable sizes alias free='$(if test $# -eq 0;then opts=(-m);else opts=("$@");fi; echo free "$opts[@]")' # Show sizes in MB
These echo
versions would define the alias with a one time parsing, and not for later invocations that dynamically parse the options :wink:
The other version using _f
and undefining it after invocation could work, but maybe we should just use a random GUID as function name for each :thinking: :wink:
PS: I've changed to Kubuntu
again away from Manjaro
so it's up to you guys to make any further changes :wink:
This is a bugfix for #36:
@Chrysostomus, I only used the
free
when i made the previous PR, and noticed the bug when usingcp
, sorry about that :wink: Now all 3 are tested :rofl:Ill leave it as a Draft, so you can check it also before we create the final MR... (Feel free to change it from Draft to final MR)