pfsshell icon indicating copy to clipboard operation
pfsshell copied to clipboard

[FR] Print piped commands as they are executed

Open zulc22 opened this issue 3 years ago • 5 comments

Checks

  • [X] I have checked existing feature requests for duplicates and found none

Describe the FR

If you create a "script" for pfsshell and attempt to pipe it in, the prompt is the only thing shown on screen and it doesn't really let the user know what's happening or how much of the script has executed.

device /dev/sdc
mount __common
put file.ext
umount
exit

cat script.txt | pfsshell

Describe the solution you'd like

Print piped commands as they are executed

Describe alternatives you've considered

No response

Additional context

No response

zulc22 avatar Mar 07 '22 19:03 zulc22

You can use tee to also print commands to console

uyjulian avatar Mar 07 '22 19:03 uyjulian

You can use tee to also print commands to console

At least on Windows, that most definitely does not work. type [file] | busybox tee CON | pfsshell just prints out all of the text, ignoring whether pfsshell tried to read the line yet or not.

zulc22 avatar Mar 07 '22 19:03 zulc22

Due to how buffering works it will read as much as possible from the input

uyjulian avatar Mar 07 '22 19:03 uyjulian

@zulc22 it looks like that even tee is not necessary: https://github.com/GDX-X/PFS-BatchKit-Manager/blob/main/PFS-BatchKit-Manager/!PFS-BatchKit-Manager.bat#L1182-L1185 maybe @GDX-X can provide more piping examples

echo device !@hdl_path! > "%~dp0TMP\pfs-prt.txt"
echo ls -l >> "%~dp0TMP\pfs-prt.txt"
echo exit >> "%~dp0TMP\pfs-prt.txt"
type "%~dp0TMP\pfs-prt.txt" | "%~dp0BAT\pfsshell" 2>&1 | "%~dp0BAT\busybox" tee > "%~dp0TMP\pfs-prt.log"

AKuHAK avatar Mar 09 '22 19:03 AKuHAK

@zulc22 I couldn't find how to print the piped commands as they are executed in the console.

if you want to understand how pfsshell works, use it do your commands one by one directly then redo the shema in echo that you will put in a txt.

like in the example that AKuHAK showed you

GDX-X avatar Mar 09 '22 22:03 GDX-X