Conversation
Signed-off-by: Xenia Lang <xenia.lang@tngtech.com>
| get_command() { | ||
| role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer. | ||
| os=get_os | ||
| role="You translate the given input into a bash command for $os. You may not use natural language, but only a bash command as an answer. |
There was a problem hiding this comment.
I would suggest not to use bash as we do not know whether the user is actually using bash or another shell (such as zsh, fish, ...). I would suggest to either use the more generic shell (maybe even request the command to be POSIX compliant).
There was a problem hiding this comment.
Alternatively one may retrieve information about the shell in use, e.g. from the SHELL env variable.
There was a problem hiding this comment.
@heiderich @xenia-lang I'd like to get this PR merged—the idea seems useful to me.
What do you think about getting the current shell name as well as the OS to cover all cases?
e.g. using
get_shell()
if [ -n "$SHELL" ]; then
current_shell="$(basename "$SHELL")"
else
current_shell=""
and the adapting the prompt to:
role="You translate the given input into a shell command for $os. The user is running $current_shell. You may not use natural language, but only the command as an answer."
JonathanRohland-TNG
left a comment
There was a problem hiding this comment.
Let's make sure that we address the open comments before merging.
| get_command() { | ||
| role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer. | ||
| os=get_os | ||
| role="You translate the given input into a bash command for $os. You may not use natural language, but only a bash command as an answer. |
There was a problem hiding this comment.
@heiderich @xenia-lang I'd like to get this PR merged—the idea seems useful to me.
What do you think about getting the current shell name as well as the OS to cover all cases?
e.g. using
get_shell()
if [ -n "$SHELL" ]; then
current_shell="$(basename "$SHELL")"
else
current_shell=""
and the adapting the prompt to:
role="You translate the given input into a shell command for $os. The user is running $current_shell. You may not use natural language, but only the command as an answer."
|
|
||
| get_command() { | ||
| role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer. | ||
| os=get_os |
There was a problem hiding this comment.
Does the assignment to os in os=get_os have any effect at all?
If I read the definition of get_os correctly, then it doesn't actually return any value, but directly assign the OS name to the os variable.
To return something, shouldn't it be:
get_os() {
unameOut=$(uname -s)
case "$unameOut" in
Darwin)
echo "MacOS"
;;
Linux)
echo "Linux"
;;
*)
echo "Linux"
;;
esac
}There was a problem hiding this comment.
And then the function call would be os=$(get_os)
|
bugbot run |
🚨 BugBot failed to runRemote branch not found for this Pull Request. It may have been merged or deleted (requestId: serverGenReqId_f1413ae6-f32f-4dc9-8c2e-5153e6d856f3). |
|
Closing this in favor of #66 |
No description provided.