refactor(shell): extract _fish_mkdir_p utility; improve poke output
- Add _fish_mkdir_p: reusable mkdir -p with three output modes: --path (default): "Created: ~/full/path/" on one line --tree: dimmed existing anchor + cyan tree of newly-created dirs --silent: no output HOME is substituted with ~ in all output paths - Refactor poke to delegate to _fish_mkdir_p --tree; removes inline mkdir/echo logic and gains ~ substitution and per-dir tree output
This commit is contained in:
+1
-4
@@ -8,10 +8,7 @@ function poke --description 'touch with automatic parent directory creation'
|
||||
end
|
||||
for _path in $argv
|
||||
set -l _dir (dirname $_path)
|
||||
if not test -d $_dir
|
||||
mkdir -p $_dir
|
||||
and echo (set_color --bold cyan)"Created: "(set_color cyan)"$_dir"(set_color normal)
|
||||
end
|
||||
_fish_mkdir_p --tree $_dir
|
||||
touch $_path
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user