File tree 3 files changed +21
-13
lines changed
3 files changed +21
-13
lines changed Original file line number Diff line number Diff line change 1
1
build :
2
- @go build .
2
+ @go build -ldflags " -s -w " .
3
3
4
4
run :
5
5
@go run .
6
6
7
7
test :
8
- @go test ./...
8
+ @go test ./...
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "fmt"
4
5
"os"
5
6
6
7
dirp "github.com/avindra/dirp/src"
@@ -29,6 +30,9 @@ func main() {
29
30
} else {
30
31
dirp .PrintHook () // fish
31
32
}
33
+ } else if arg0 == "cfg" {
34
+ fmt .Print (dirp .GetConfigPath ())
35
+ os .Exit (2 )
32
36
}
33
37
return
34
38
}
Original file line number Diff line number Diff line change @@ -12,10 +12,16 @@ if [[ $? -eq 0 ]]; then
12
12
fi
13
13
14
14
function dir() {
15
- dir=$(dirp $@)
16
- if [[ -n $dir ]]; then
17
- echo "Switching to $dir... "
18
- pushd "$dir"
15
+ response=$(dirp $@)
16
+ status=$?
17
+ if [[ -n $response ]]; then
18
+ if [[ $status -eq 2 ]]; then
19
+ $EDITOR "$response"
20
+ return $?
21
+ fi
22
+
23
+ echo "Switching to $response... "
24
+ pushd "$response"
19
25
fi
20
26
}
21
27
@@ -25,21 +31,19 @@ function dir() {
25
31
// PrintHook emits shell code for Fish
26
32
func PrintHook () {
27
33
fmt .Println (`function dir
28
- if [ "$argv[1]" = "cfg" ]
29
- $EDITOR "$HOME/.config/dir/list"
34
+ set response (dirp $argv)
35
+ if [ $status = 2 ]
36
+ $EDITOR "$response"
30
37
return $status
31
- else
32
- # default
33
- set selection (dirp $argv)
34
38
end
35
39
36
- if [ "x$selection " = "x" ]
40
+ if [ "x$response " = "x" ]
37
41
echo -n "How are we doing @ "
38
42
uptime
39
43
return $status
40
44
end
41
45
42
- echo "Switching to $selection "
46
+ echo "Switching to $response "
43
47
pushd "$selection"
44
48
end` )
45
49
}
You can’t perform that action at this time.
0 commit comments