Skip to content

Commit

Permalink
Add initial project structure (#3)
Browse files Browse the repository at this point in the history
Issue: #1
  • Loading branch information
felipemfp authored Oct 27, 2018
1 parent 1264889 commit d1409b5
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# dep
vendor/
.new-vendor/
bin/
pkg/
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
PROJECT := sinonimos

GOPATH := $(CURDIR)
GOPATHCMD=GOPATH=$(GOPATH)
GOCMD=$(GOPATHCMD) go

PROJECT_PATH=$(GOPATH)/src/$(PROJECT)

DEP=cd $(PROJECT_PATH) && GOPATH=$(GOPATH) dep

.DEFAULT_GOAL: install

.PHONY: dep-ensure dep-add dep-status install run

dep-ensure:
@cd ${PROJECT_PATH} $(DEP) ensure -v

dep-update:
@cd ${PROJECT_PATH} $(DEP) ensure -v -update $(PACKAGE)

dep-add:
ifdef PACKAGE
@$(DEP) ensure -v -add $(PACKAGE)
else
@echo "Usage: PACKAGE=<package url> make dep-add"
@echo "The environment variable \`PACKAGE\` is not defined."
endif

dep-status:
@$(DEP) status

install: dep-ensure
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOCMD) build -a -installsuffix cgo -ldflags="-w -s" -o ./bin/$(PROJECT) ./src/$(PROJECT)

run:
@GOPATH=$(GOPATH) $(GOCMD) run $(PROJECT_PATH)/main.go
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# synonyms-cli
:computer::capital_abcd: Find synonyms without leaving your terminal

:computer::capital_abcd: Find synonyms without leaving your terminal
26 changes: 26 additions & 0 deletions src/sinonimos/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/sinonimos/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[prune]
go-tests = true
unused-packages = true
24 changes: 24 additions & 0 deletions src/sinonimos/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"fmt"
"os"

cli "github.com/jawher/mow.cli"
)

func main() {
app := cli.App("sinonimos", "Encontre sinônimos")

app.Spec = "PALAVRA"

var (
word = app.StringsArg("PALAVRA", nil, "Palavra para encontrar sinônimos")
)

app.Action = func() {
fmt.Printf("Buscando sinônimos para %s\n", *word)
}

app.Run(os.Args)
}

0 comments on commit d1409b5

Please sign in to comment.