Skip to content

Commit

Permalink
🔨 unify the project/application name
Browse files Browse the repository at this point in the history
  • Loading branch information
Omochice committed Jul 22, 2021
1 parent 1527a43 commit 963c570
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: goreleaser

on:
push:
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
project_name: deepl-translation-cli
project_name: deepl-translate-cli
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
- main: .
binary: deepl-translation
binary: deepl-translate-cli
ldflags:
- -s -w
- -X main.Version={{.Version}}
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
1. Get deepl access token. See [here](https://www.deepl.com/docs-api).

2. Set access token as `DEEPL_TOKEN`
ex. in `Bash`.
```bash
export DEEPL_TOKEN <YOUR TOKEN>
```

3. Make configure file in `<user home directory>/.config/deepl-translation/setting.json`.
ex. in `Bash`.

```bash
export DEEPL_TOKEN <YOUR TOKEN>
```

3. Make configure file in `<user home directory>/.config/deepl-translate-cli/setting.json`.

If run command without existing setting file, auto make it.

Expand All @@ -28,17 +30,17 @@
## Usage

- If you want translate from existing file.
```console
$ deepl-translation <text.txt>
```
```console
$ deepl-translate-cli <text.txt>
```

- If you want use stdin.
- with pipe
- with pipe
```console
$ echo "hello" | deepl-translation --stdin
$ echo "hello" | deepl-translate-cli --stdin
```
- with input
```console
$ deepl-translation --stdin
$ deepl-translate-cli --stdin
<input text that wanted translate> <Enter>
```
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func LoadSettings(c *cli.Context) (Setting, error) {
return setting, err
}

configPath := filepath.Join(homeDir, ".config", "deepl-translation", "setting.json")
configPath := filepath.Join(homeDir, ".config", "deepl-translate-cli", "setting.json")
bytes, err := ioutil.ReadFile(configPath)
if err != nil {
errStr := fmt.Errorf("Not exists such file. %s\n\tauto make it, please write it. ", configPath)
Expand Down Expand Up @@ -141,13 +141,14 @@ func ParseResponse(resp *http.Response) (Response, error) {

func main() {
app := &cli.App{
Name: "deepl",
Name: "deepl-translate-cli",
Usage: "Translate sentences.",
UsageText: "deepl [-s|-t] <inputfile | --stdin> ",
UsageText: "deepl-translate-cli [-s|-t] <inputfile | --stdin> ",
Version: fmt.Sprintf("%s (rev %s) [%s %s %s] [build at %s by %s]", version, commit, runtime.GOOS, runtime.GOARCH, runtime.Version(), date, buildBy),
Authors: []*cli.Author{
&cli.Author{
Name: "Omochice"},
Name: "Omochice",
},
},

Flags: []cli.Flag{
Expand Down

0 comments on commit 963c570

Please sign in to comment.