-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
327e470
commit 41c2f98
Showing
5 changed files
with
126 additions
and
2 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 |
---|---|---|
|
@@ -12,3 +12,5 @@ | |
*.out | ||
|
||
.DS_Store | ||
|
||
dist/ |
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,70 @@ | ||
# This is an example goreleaser.yaml file with some sane defaults. | ||
# Make sure to check the documentation at http://goreleaser.com | ||
before: | ||
hooks: | ||
# you may remove this if you don't use vgo | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
#- go generate ./... | ||
builds: | ||
- | ||
main: ./cmd/main.go | ||
env: | ||
- CGO_ENABLED=0 | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
brews: | ||
- | ||
# Name template of the recipe | ||
# Default to project name | ||
name: dkl | ||
|
||
# Github repository to push the tap to. | ||
github: | ||
owner: budougumi0617 | ||
name: homebrew-tap | ||
|
||
# Template for the url which is determined by the given Token (github or gitlab) | ||
# Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}" | ||
# Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/uploads/{{ .ArtifactUploadHash }}/{{ .ArtifactName }}" | ||
url_template: "http://github.com/budougumi0617/dkl/releases/{{ .Tag }}/{{ .ArtifactName }}" | ||
|
||
# Git author used to commit to the repository. | ||
# Defaults are shown. | ||
commit_author: | ||
name: goreleaserbot | ||
email: goreleaser@carlosbecker.com | ||
|
||
# Your app's homepage. | ||
# Default is empty. | ||
homepage: "https://budougumi0617.github.io/" | ||
|
||
# Your app's description. | ||
# Default is empty. | ||
description: "dkl is the text-mode interface for docker and kubectl command." | ||
|
||
# So you can `brew test` your formula. | ||
# Default is empty. | ||
test: | | ||
system "#{bin}/dkl --version" | ||
... | ||
# Custom install script for brew. | ||
# Default is 'bin.install "program"'. | ||
install: | | ||
bin.install "dkl" |
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,7 +1,22 @@ | ||
package main | ||
|
||
import "fmt" | ||
import ( | ||
"flag" | ||
"log" | ||
"os" | ||
|
||
"github.com/budougumi0617/dkl" | ||
) | ||
|
||
func main() { | ||
fmt.Println("vim-go") | ||
log.SetFlags(0) | ||
err := dkl.Run(os.Args, os.Stdin, os.Stdout, os.Stderr) | ||
if err != nil && err != flag.ErrHelp { | ||
log.Println(err) | ||
exitCode := 1 | ||
if ecoder, ok := err.(interface{ ExitCode() int }); ok { | ||
exitCode = ecoder.ExitCode() | ||
} | ||
os.Exit(exitCode) | ||
} | ||
} |
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,37 @@ | ||
package dkl | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"io" | ||
) | ||
|
||
const ( | ||
version = "0.0.0" | ||
) | ||
|
||
// Run is entry point. | ||
func Run(args []string, inStream io.Reader, outStream, errStream io.Writer) error { | ||
var v bool | ||
cmdName := args[0] | ||
vdesc := "Print version information and quit." | ||
flags := flag.NewFlagSet(cmdName, flag.ContinueOnError) | ||
flags.SetOutput(errStream) | ||
|
||
flags.BoolVar(&v, "version", false, vdesc) | ||
flags.BoolVar(&v, "v", false, vdesc) | ||
|
||
if err := flags.Parse(args[1:]); err != nil { | ||
return err | ||
} | ||
|
||
// バージョン情報の表示 | ||
if v { | ||
fmt.Fprintf(errStream, "%s version %s\n", cmdName, version) | ||
return nil | ||
} | ||
|
||
fmt.Fprint(outStream, "now implementing...\n") | ||
|
||
return nil | ||
} |