-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from DrakeW/develop
v0.2.1 develop to master
- Loading branch information
Showing
17 changed files
with
471 additions
and
97 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 |
---|---|---|
|
@@ -13,4 +13,7 @@ | |
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
*.out | ||
|
||
# build | ||
build/* |
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,19 @@ | ||
.PHONY: all dep build build-darwin build-linux | ||
|
||
VERSION := $(shell git describe --tags --abbrev=0) | ||
|
||
all: dep build | ||
|
||
dep: | ||
dep ensure | ||
|
||
prep-build: | ||
mkdir -p build | ||
|
||
build-darwin: main.go dep prep-build | ||
env GOOS=darwin GOARCH=amd64 go build -o build/corgi_$(VERSION)_darwin_amd64 | ||
|
||
build-linux: main.go dep prep-build | ||
env GOOS=linux GOARCH=amd64 go build -o build/corgi_$(VERSION)_linux_amd64 | ||
|
||
build: build-darwin build-linux |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cmd | ||
|
||
import "github.com/spf13/cobra" | ||
|
||
var removeCmd = &cobra.Command{ | ||
Use: "remove", | ||
Short: "Remove a snippet", | ||
Args: cobra.MaximumNArgs(1), | ||
RunE: remove, | ||
} | ||
|
||
func remove(cmd *cobra.Command, args []string) error { | ||
conf, snippetsMeta, err := loadConfigAndSnippetsMeta() | ||
if err != nil { | ||
return err | ||
} | ||
// find snippet title | ||
var title string | ||
if len(args) == 0 { | ||
title, err = filterSnippetTitle(conf.FilterCmd, snippetsMeta.GetSnippetTitles()) | ||
if err != nil { | ||
return err | ||
} | ||
} else { | ||
title = args[0] | ||
} | ||
if err = snippetsMeta.DeleteSnippet(title); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(removeCmd) | ||
} |
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
Oops, something went wrong.