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

command built-in does not support -p option #1795

Closed
KingMob opened this issue Jan 17, 2024 · 5 comments
Closed

command built-in does not support -p option #1795

KingMob opened this issue Jan 17, 2024 · 5 comments

Comments

@KingMob
Copy link
Collaborator

KingMob commented Jan 17, 2024

From Zulip:

Lately, I've been really taken with the Warp terminal. Like Oils, it tries to jettison historical cruft, and one of the ways it does this is by replacing the terminal as a grid of TTY characters, and treating the input more like a standard OS input field.

By default, this only supports bash/zsh/fish. Warp also has an option to "Warpify" subshells, which is mostly used for things like SSH or Docker, but I thought I'd try it out on osh. Unfortunately, I got some errors, mostly saying "'command' doesn't accept flag -p".

Is this a known issue? I tried searching, but "command" isn't a search-friendly term.

If I try the interactive warpify option by hitting ⌘-I, I get:

<ll\": \"fish\", \"is_subshell\": true}}" | od -An -v -tx1 | command tr -d " \n");echo -n \u1b\u50\u24"d$_msg"\u9c;set -e _hostname _user _msg;'
   [ -z $WARP_BOOTSTRAPPED ] && echo $0 | command -p grep -q zsh && unsetopt ZLE && eval 'setopt hist_ignore_space; unsetopt ZLE; WARP_IS_SUBSHELL=1; WARP_SESSION_ID="$(command -p date +%s)$RANDOM"; _hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n); _user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER); _msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"zsh\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n"); printf '"'"'\x1b\x50\x24\x64%s\x9c'"'"' "$_msg"; unset _hostname _user _msg;' || [ -z $WARP_BOOTSTRAPPED ] && echo $0 | command -p grep -q bash && eval 'command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '"'"'\x1b\x50\x24\x64%s\x9c'"'"' $_msg;unset _hostname _user _msg;' || [ -z $WARP_BOOTSTRAPPED ] && [ $FISH_VERSION ] && eval 'set -g WARP_SESSION_ID (random);set _hostname $(command -v hostname >/dev/null 2>&1 && command hostname 2>/dev/null || uname -n);set _user $(command -v whoami >/dev/null 2>&1 && command whoami 2>/dev/null || echo $USER);set _msg $(echo -n "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"shell\": \"fish\", \"is_subshell\": true}}" | od -An -v -tx1 | command tr -d " \n");echo -n \u1b\u50\u24"d$_msg"\u9c;set -e _hostname _user _msg;'
                                                  ^~
[ interactive ]:1: 'command' doesn't accept flag -p
   [ -z $WARP_BOOTSTRAPPED ] && echo $0 | command -p grep -q zsh && unsetopt ZLE && eval 'setopt hist_ignore_space; unsetopt ZLE; WARP_IS_SUBSHELL=1; WARP_SESSION_ID="$(command -p date +%s)$RANDOM"; _hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n); _user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER); _msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"zsh\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n"); printf '"'"'\x1b\x50\x24\x64%s\x9c'"'"' "$_msg"; unset _hostname _user _msg;' || [ -z $WARP_BOOTSTRAPPED ] && echo $0 | command -p grep -q bash && eval 'command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '"'"'\x1b\x50\x24\x64%s\x9c'"'"' $_msg;unset _hostname _user _msg;' || [ -z $WARP_BOOTSTRAPPED ] && [ $FISH_VERSION ] && eval 'set -g WARP_SESSION_ID (random);set _hostname $(command -v hostname >/dev/null 2>&1 && command hostname 2>/dev/null || uname -n);set _user $(command -v whoami >/dev/null 2>&1 && command whoami 2>/dev/null || echo $USER);set _msg $(echo -n "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"shell\": \"fish\", \"is_subshell\": true}}" | od -An -v -tx1 | command tr -d " \n");echo -n \u1b\u50\u24"d$_msg"\u9c;set -e _hostname _user _msg;'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^~
[ interactive ]:1: 'command' doesn't accept flag -p

If I try the automatic warpification by appending printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "bash"}}\x9c' to the end of my oshrc, I get a different command -p error:

osh

<ell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '"'"'\x1b\x50\x24\x64%s\x9c'"'"' $_msg;unset _hostname _user _msg;'
  command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '\x1b\x50\x24\x64%s\x9c' $_msg;unset _hostname _user _msg;
          ^~
[ eval word at line 1 of [ interactive ] ]:1: 'command' doesn't accept flag -p
  command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '\x1b\x50\x24\x64%s\x9c' $_msg;unset _hostname _user _msg;
                                                                                                                                 ^~
[ eval word at line 1 of [ interactive ] ]:1: 'command' doesn't accept flag -p
  command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '\x1b\x50\x24\x64%s\x9c' $_msg;unset _hostname _user _msg;
                                                                                                                                                                                                                                                     ^~
[ eval word at line 1 of [ interactive ] ]:1: 'command' doesn't accept flag -p
  command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '\x1b\x50\x24\x64%s\x9c' $_msg;unset _hostname _user _msg;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^~
[ eval word at line 1 of [ interactive ] ]:1: 'command' doesn't accept flag -p
  command -p stty raw;unset PROMPT_COMMAND;HISTCONTROL=ignorespace;HISTIGNORE=" *";WARP_IS_SUBSHELL=1;WARP_SESSION_ID="$(command -p date +%s)$RANDOM";_hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n);_user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER);_msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"bash\", \"user\": \"$_user\", \"hostname\": \"$_hostname\", \"is_subshell\": true}}" | command -p od -An -v -tx1 | command -p tr -d " \n");printf '\x1b\x50\x24\x64%s\x9c' $_msg;unset _hostname _user _msg;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^~
[ eval word at line 1 of [ interactive ] ]:1: 'command' doesn't accept flag -p
@andychu
Copy link
Contributor

andychu commented Jan 27, 2024

After the refactoring which touched a few places, this turned out to be straightforward

The tests passed on the first try!

This will be out with the next release, thank you for testing


Refactoring - 205e64a

Small change - 3d1aa80

(and then I had to fix C++ unit tests afterward)

@KingMob
Copy link
Collaborator Author

KingMob commented Jan 28, 2024

Awesome, thanks!

@KingMob
Copy link
Collaborator Author

KingMob commented Jan 29, 2024

Should I/you close this issue? Or will you do it as part of the release?

BTW, thanks for your enthusiasm and hard work on this! I know (only too well) that thanks are sometimes all we get for FOSS. 🙏🏻

Looking forward to making osh my daily driver with 0.2.0.

@andychu
Copy link
Contributor

andychu commented Jan 29, 2024

I have a script that collects these for the release, so no need to close it

I'm glad people are excited about the project :)

@andychu
Copy link
Contributor

andychu commented Feb 23, 2024

Released, thanks for testing and contributing! https://www.oilshell.org/blog/2024/02/release-0.20.0.html

@andychu andychu closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants