organize: The `shell` action in v2.0.5 not working as before (v1.10.1)
Hey, itβs me again. Sorry for being annoying, I hope you donβt mind my bug reports. π¬ Iβm trying to post one issue at a time, the blockers firstβ¦ π
Iβm running the latest version from GitHub (pipx install git+https://github.com/tfeldmann/organize.git).
The shell is not behaving the same way it did before.
This is my rule, converted from v1.10.1 and enhanced with the new syntax from v2.0.5:
rules:
- name: "Remove some hidden files and then remove empty dirs"
locations: ~/
filters:
- name:
startswith: .bash_history
actions:
- shell:
cmd: "fd -uu -0 -tf -i .DS_Store ~/Downloads ~/Desktop ~/OneDrive ~/Documents | xargs -0 rm -v"
ignore_errors: true
- echo: "{shell.output}"
- shell:
cmd: "fd -uu -0 -tf -i .nomedia ~/Downloads ~/Desktop ~/OneDrive ~/Documents | xargs -0 rm -v"
ignore_errors: true
- echo: "{shell.output}"
- shell:
cmd: "find -f ~/Downloads -f ~/Desktop -f ~/Documents ~/OneDrive -mindepth 1 -type d -empty -print -delete"
ignore_errors: true
- echo: "{shell.output}"
This is the output:
β― organize run
organize 2.0.5
Config: "/Users/aa/Library/Application Support/organize/config.yaml"
β Remove some hidden files and then remove empty dirs βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
/Users/aa
.bash_history
- (shell) $ fd -uu -0 -tf -i .DS_Store ~/Downloads ~/Desktop ~/OneDrive ~/Documents | xargs -0 rm -v
- (echo) error: Found argument '-v' which wasn't expected, or isn't valid in this context
- (echo)
- (echo) USAGE:
- (echo) fd [FLAGS/OPTIONS] [<pattern>] [<path>...]
- (echo)
- (echo) For more information try --help
- (shell) $ fd -uu -0 -tf -i .nomedia ~/Downloads ~/Desktop ~/OneDrive ~/Documents | xargs -0 rm -v
- (echo) error: Found argument '-v' which wasn't expected, or isn't valid in this context
- (echo)
- (echo) USAGE:
- (echo) fd [FLAGS/OPTIONS] [<pattern>] [<path>...]
- (echo)
- (echo) For more information try --help
- (shell) $ find -f ~/Downloads -f ~/Desktop -f ~/Documents ~/OneDrive -mindepth 1 -type d -empty -print -delete
- (echo) find: ~/Downloads: No such file or directory
- (echo) find: ~/Desktop: No such file or directory
- (echo) find: ~/Documents: No such file or directory
- (echo) find: ~/OneDrive: No such file or directory
success 1 / fail 0
If I run the command manually, exactly as in the rule, it works:
β― fd -uu -0 -tf -i .DS_Store ~/Downloads ~/Desktop ~/OneDrive ~/Documents | xargs -0 rm -v
/Users/aa/Desktop/.DS_Store
/Users/aa/OneDrive/.DS_Store
Somehow shell expansion is not working, the ~/ path is not being expanded.
All these directories exist, despite the error in the output:
- (echo) find: ~/Downloads: No such file or directory
- (echo) find: ~/Desktop: No such file or directory
- (echo) find: ~/Documents: No such file or directory
- (echo) find: ~/OneDrive: No such file or directory
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 21 (11 by maintainers)
Please wait a moment, Iβm getting this sorted out.
Quoto, in the previous version it was possible to see the shell output in real time and this allowed me to be able to act if my intervention was required. For example, among my commands I have
brew upgrade, which allows you to update installed packages and it is possible that my intervention may be required, to confirm an action or to enter the root password. If this happens, nowβ ΄ organizingremains in the loop because it is not possible to intervene in the shell.One more thing: is there a way to show the current output of the
shellcommand being executed instead ofβ ΄ organizingwith the animated icon?Now the output only shows after the command is over. If itβs a long-running command, I donβt see whatβs going on.
If I remember well, it worked like this in v1.10.1.
I can also open a separate issue for this.
@andreoliwa - You might be able to use the environment variable of $USER instead of ~
Such as the two examples below:
- echo: "/Users/{env.USER}/"or