Skip to content

Commit

Permalink
✨ add skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
budougumi0617 committed Sep 15, 2019
1 parent 327e470 commit 41c2f98
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
*.out

.DS_Store

dist/
70 changes: 70 additions & 0 deletions .goreleaser.yml
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"
19 changes: 17 additions & 2 deletions cmd/main.go
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)
}
}
37 changes: 37 additions & 0 deletions dkl.go
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
}
Empty file added go.sum
Empty file.

0 comments on commit 41c2f98

Please sign in to comment.