@@ -9,30 +9,30 @@ yellow=$'\033[0;33m'
99reset=$' \033 [0m'
1010
1111# Extract values using jq
12- cwd=$( echo " $input " | jq -r ' .workspace.current_dir' )
13- model=$( echo " $input " | jq -r ' .model.display_name' )
12+ cwd=$( echo " ${ input} " | jq -r ' .workspace.current_dir' )
13+ model=$( echo " ${ input} " | jq -r ' .model.display_name' )
1414
1515# Get directory using starship
16- dir=$( cd " $cwd " && starship module directory)
16+ dir=$( cd " ${ cwd} " && starship module directory)
1717
1818# Check if we're in a git repo and get branch
1919git_info=" "
20- if git -C " $cwd " rev-parse --git-dir > /dev/null 2>&1 ; then
21- branch=$( git -C " $cwd " branch --show-current 2> /dev/null || echo " detached" )
20+ if git -C " ${ cwd} " rev-parse --git-dir > /dev/null 2>&1 ; then
21+ branch=$( git -C " ${ cwd} " branch --show-current 2> /dev/null || echo " detached" )
2222 git_info=" on ${magenta}${branch}${reset} "
2323fi
2424
2525# Calculate context window percentage
2626context_info=" "
27- usage=$( echo " $input " | jq ' .context_window.current_usage' )
28- if [ " $ usage" != " null" ]; then
29- current=$( echo " $usage " | jq ' .input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens' )
30- size=$( echo " $input " | jq ' .context_window.context_window_size' )
31- if [ " $ size" != " null" ] && [ " $ size" != " 0" ]; then
27+ usage=$( echo " ${ input} " | jq ' .context_window.current_usage' )
28+ if [[ ${ usage} != " null" ] ]; then
29+ current=$( echo " ${ usage} " | jq ' .input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens' )
30+ size=$( echo " ${ input} " | jq ' .context_window.context_window_size' )
31+ if [[ ${ size} != " null" ]] && [[ ${ size} != " 0" ] ]; then
3232 pct=$(( current * 100 / size))
3333 context_info=" | ${yellow}${pct} %${reset} ctx"
3434 fi
3535fi
3636
3737# Output status line
38- printf " %s%s | %s%s\n" " $dir " " $git_info " " $model " " $context_info "
38+ printf " %s%s | %s%s\n" " ${ dir} " " ${ git_info} " " ${ model} " " ${ context_info} "
0 commit comments