ps2homebrew / pfsshell

Browse and edit PFS filesystems on APA-formatted hard drive
GNU General Public License v2.0
99 stars 22 forks source link

[FR] Print piped commands as they are executed #36

Open zulc22 opened 2 years ago

zulc22 commented 2 years ago

Checks

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

uyjulian commented 2 years ago

You can use tee to also print commands to console

zulc22 commented 2 years ago

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.

uyjulian commented 2 years ago

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

AKuHAK commented 2 years ago

@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"
GDX-X commented 2 years ago

@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