-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
164 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -ev | ||
go build | ||
./goto add test "http://example.com" | ||
./goto add test test test "http://baidu.com" | ||
./goto get test test test | ||
./goto get test | ||
./goto list tes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
package handler | ||
|
||
func List(args []string) { | ||
import ( | ||
"github.com/Huweicai/goto/alfred" | ||
"github.com/Huweicai/goto/config" | ||
"log" | ||
"strings" | ||
) | ||
|
||
func List(args []string) { | ||
nest, err := config.NewNest(config.GetConfigPath()) | ||
if err != nil { | ||
log.Fatalf(err.Error()) | ||
return | ||
} | ||
outKV := nest.ListWithPre(args) | ||
output := alfred.NewOutput() | ||
for k, v := range outKV { | ||
arg := strings.Join(append(args[:len(args)-1], k), " ") | ||
output.AddSimpleTip(k, v, arg, arg) | ||
} | ||
output.Show() | ||
} |