Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve] command prompt #3

Open
sc0ttj opened this issue Sep 1, 2022 · 1 comment
Open

[improve] command prompt #3

sc0ttj opened this issue Sep 1, 2022 · 1 comment

Comments

@sc0ttj
Copy link
Owner

sc0ttj commented Sep 1, 2022

The "shell prompt" mode can only run commands in the following syntax:

$cmd $selection

where:

  • $cmd is the command chosen from the list, or typed out
  • $selection is the file(s) chosen in file manager mode

Need to work out how to insert $selection into any place in a command string, so users can write stuff like the following and hit ENTER:

mv {} some/new/path/{}
cp {} some/new/path/

where:

  • {} is each file listed in $selection
@sc0ttj sc0ttj changed the title [feature] command prompt [improve] command prompt Sep 1, 2022
@sc0ttj
Copy link
Owner Author

sc0ttj commented Sep 2, 2022

Maybe use something like this:

# echo -e "1a
2b
3c" | xargs -P $(nproc --ignore=1) -d'\n' -I{} -n1 -r echo "FOO {} BAR"

FOO 1a BAR
FOO 2b BAR
FOO 3c BAR

xargs options explained:

-P $(nproc --ignore=1) - the -P enables multiple threads, nproc reports how many are available
-d'\n' - use newline char as delimeter
-I{} - replace {} with the incoming line, implies -L1 (max lines one, the default)
-n1 - max args 1 (everything on the incoming line is interpolated into {})
-r - dont run following command if the incoming line is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant