Skip to content

Commit

Permalink
[fix] workon
Browse files Browse the repository at this point in the history
  • Loading branch information
bomgar committed Aug 2, 2023
1 parent 77fd517 commit 8e629e1
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/shell/setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ __fw_complete()
local tags=()
while read line; do
tags+=($line)
done < <(fw -q tag ls)
done < <(fw tag ls)
echo ${tags[@]}
}

Expand Down Expand Up @@ -401,6 +401,6 @@ __fw_projects()
local projects=()
while read line; do
projects+=($line)
done < <(fw -q ls)
done < <(fw ls)
echo ${projects[@]}
}
4 changes: 2 additions & 2 deletions src/shell/setup.fish
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function __fw_projects
fw -q ls
fw ls
end

function __fw_tags
fw -q tag ls
fw tag ls
end

function __fw_subcommands
Expand Down
4 changes: 2 additions & 2 deletions src/shell/setup.zsh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
__fw_projects() {
local projects;
fw -q ls | while read line; do
fw ls | while read line; do
projects+=( $line );
done;
_describe -t projects 'project names' projects;
};

__fw_tags() {
local tags;
fw -q tag ls | while read line; do
fw tag ls | while read line; do
tags+=( $line );
done;
_describe -t tags 'tag names' tags;
Expand Down
10 changes: 5 additions & 5 deletions src/shell/workon-fzf.bash
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
__workon()
{
local PROJECT="$(fw -q ls | fzf --cycle --query=$1 --color=light --preview-window=top:50% --preview='fw -q inspect {}' --no-mouse --select-1)"
local SCRIPT="$(fw -q gen-workon $2 $PROJECT)"
local PROJECT="$(fw ls | fzf --cycle --query=$1 --color=light --preview-window=top:50% --preview='fw inspect {}' --no-mouse --select-1)"
local SCRIPT="$(fw gen-workon $2 $PROJECT)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
[ $? -eq 0 ] && eval "$SCRIPT" || printf "$SCRIPT\n"
}

reworkon()
{
local SCRIPT="$(fw -q gen-reworkon $@)"
local SCRIPT="$(fw gen-reworkon $@)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
[ $? -eq 0 ] && eval "$SCRIPT" || printf "$SCRIPT"
}
Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon-fzf.fish
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ function __fish_fw_use_script
end

function __workon
set -l project (fw -q ls | fzf --cycle --query=$argv[1] --color=light --preview-window=top:50% --preview='fw -q inspect {}' --no-mouse --select-1)
set -l script (fw -q gen-workon $argv[2] $project)
set -l project (fw ls | fzf --cycle --query=$argv[1] --color=light --preview-window=top:50% --preview='fw inspect {}' --no-mouse --select-1)
set -l script (fw gen-workon $argv[2] $project)
__fish_fw_use_script $status $script
end

Expand All @@ -21,7 +21,7 @@ function nworkon
end

function reworkon
set -l script (fw -q gen-reworkon $argv)
set -l script (fw gen-reworkon $argv)
__fish_fw_use_script $status $script
end

Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon-fzf.zsh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__workon () {
PROJECT="$(fw -q ls | fzf --cycle --query=$1 --color=light --preview-window=top:50% --preview='fw -q inspect {}' --no-mouse --select-1)"
SCRIPT="$(fw -q gen-workon $2 $PROJECT)";
PROJECT="$(fw ls | fzf --cycle --query=$1 --color=light --preview-window=top:50% --preview='fw inspect {}' --no-mouse --select-1)"
SCRIPT="$(fw gen-workon $2 $PROJECT)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
Expand All @@ -9,7 +9,7 @@ __workon () {
};

reworkon () {
SCRIPT="$(fw -q gen-reworkon $@)";
SCRIPT="$(fw gen-reworkon $@)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
Expand Down
10 changes: 5 additions & 5 deletions src/shell/workon-sk.bash
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
__workon()
{
local PROJECT="$(fw -q ls | sk --query=$1 --color=light --preview-window=up:50% --preview='fw -q inspect {}' --no-mouse --select-1)"
local SCRIPT="$(fw -q gen-workon $2 $PROJECT)"
local PROJECT="$(fw ls | sk --query=$1 --color=light --preview-window=up:50% --preview='fw inspect {}' --no-mouse --select-1)"
local SCRIPT="$(fw gen-workon $2 $PROJECT)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
[ $? -eq 0 ] && eval "$SCRIPT" || printf "$SCRIPT\n"
}

reworkon()
{
local SCRIPT="$(fw -q gen-reworkon $@)"
local SCRIPT="$(fw gen-reworkon $@)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
[ $? -eq 0 ] && eval "$SCRIPT" || printf "$SCRIPT"
}
Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon-sk.fish
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ function __fish_fw_use_script
end

function __workon
set -l project (fw -q ls | sk --query=$argv[1] --color=light --preview-window=up:50% --preview='fw -q inspect {}' --no-mouse --select-1)
set -l script (fw -q gen-workon $argv[2] $project)
set -l project (fw ls | sk --query=$argv[1] --color=light --preview-window=up:50% --preview='fw inspect {}' --no-mouse --select-1)
set -l script (fw gen-workon $argv[2] $project)
__fish_fw_use_script $status $script
end

Expand All @@ -21,7 +21,7 @@ function nworkon
end

function reworkon
set -l script (fw -q gen-reworkon $argv)
set -l script (fw gen-reworkon $argv)
__fish_fw_use_script $status $script
end

Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon-sk.zsh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__workon () {
PROJECT="$(fw -q ls | sk --query=$1 --color=light --preview-window=up:50% --preview='fw -q inspect {}' --no-mouse --select-1)"
SCRIPT="$(fw -q gen-workon $2 $PROJECT)";
PROJECT="$(fw ls | sk --query=$1 --color=light --preview-window=up:50% --preview='fw inspect {}' --no-mouse --select-1)"
SCRIPT="$(fw gen-workon $2 $PROJECT)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
Expand All @@ -9,7 +9,7 @@ __workon () {
};

reworkon () {
SCRIPT="$(fw -q gen-reworkon $@)";
SCRIPT="$(fw gen-reworkon $@)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
workon()
{
local SCRIPT="$(fw -q gen-workon $@)"
local SCRIPT="$(fw gen-workon $@)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
Expand All @@ -9,7 +9,7 @@ workon()

reworkon()
{
local SCRIPT="$(fw -q gen-reworkon $@)"
local SCRIPT="$(fw gen-reworkon $@)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
Expand All @@ -18,7 +18,7 @@ reworkon()

reworkon()
{
local SCRIPT="$(fw -q gen-workon -x $@)"
local SCRIPT="$(fw gen-workon -x $@)"
case $(uname -s) in
MINGW*|MSYS*) SCRIPT="cd $(echo "/${SCRIPT:3}" | sed -e 's/\\/\//g' -e 's/://')" ;;
esac
Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon.fish
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ function __fish_fw_use_script
end

function workon
set -l script (fw -q gen-workon $argv)
set -l script (fw gen-workon $argv)
__fish_fw_use_script $status $script
end

function nworkon
set -l script (fw -q gen-workon -x $argv)
set -l script (fw gen-workon -x $argv)
__fish_fw_use_script $status $script
end

function reworkon
set -l script (fw -q gen-reworkon $argv)
set -l script (fw gen-reworkon $argv)
__fish_fw_use_script $status $script
end

Expand Down
6 changes: 3 additions & 3 deletions src/shell/workon.zsh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
workon () {
SCRIPT="$(fw -q gen-workon $@)";
SCRIPT="$(fw gen-workon $@)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
printf "$SCRIPT\n";
fi
};
reworkon () {
SCRIPT="$(fw -q gen-reworkon $@)";
SCRIPT="$(fw gen-reworkon $@)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
Expand All @@ -16,7 +16,7 @@ reworkon () {
};

nworkon () {
SCRIPT="$(fw -q gen-workon -x $@)";
SCRIPT="$(fw gen-workon -x $@)";
if [ $? -eq 0 ]; then
eval "$SCRIPT";
else
Expand Down

0 comments on commit 8e629e1

Please sign in to comment.