Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cSpell:ignore gomod

version: 2
updates:
- package-ecosystem: github-actions
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cSpell:ignore GOARCH GOARM buildx softprops

name: Release

on:
Expand Down Expand Up @@ -100,7 +102,7 @@ jobs:
path: artifacts

- name: Display structure of files
run: ls -Rlah
run: ls -R -lah

- name: Attach files
if: github.event_name == 'release'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cSpell:ignore pipx jsonschema schemafile

name: Tests

on:
Expand Down
7 changes: 4 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"recommendations": [
"golang.go",
"editorconfig.editorconfig",
"golang.go",
"ms-vscode.makefile-tools",
"redhat.vscode-yaml"
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker"
]
}
}
19 changes: 17 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,20 @@
"editor.formatOnSave": true,
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yaml"
}
}
},
"cSpell.words": [
"codereaper",
"Noget",
"stretchr",
"swiftlint",
"testdata",
"tmpl"
],
"cSpell.ignorePaths": [
".gitignore",
"Dockerfile",
"docs/generated",
"go.*",
"internal/translations/testdata",
]
}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cSpell:ignore trimpath coverprofile

CI = $(shell env | grep ^CI=)
VERSION = 0.0.0
SUFFIX =
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

## Installation

The prefered method of installation is through [asdf](http://asdf-vm.com/).
The preferred method of installation is through [asdf](http://asdf-vm.com/).

A lane plugin to install has been set up at [asdf-lane](https://github.com/CodeReaper/asdf-lane).

Alternatively this tool can be run directly:
```go
go run github.com/codereaper/lane@1.0.0
go run github.com/codereaper/lane@1
```

## Containerized
Expand Down
4 changes: 2 additions & 2 deletions cmd/translations.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Make sure to share the sheet with the 'client_email' assigned to your service ac
Use: "download",
Short: "Download translations",
Long: additionalHelp,
Example: " lane translations download -o output.csv -c googleapi.json -d 11p...ev7lc -f csv",
Example: " lane translations download -o output.csv -c google-api.json -d 11p...ev7lc -f csv",
RunE: func(cmd *cobra.Command, args []string) error {
return downloader.Download(context.Background(), &flags)
},
}
cmd.Flags().StringVarP(&flags.Output, "output", "o", "", "Path to save output file (Required)")
cmd.Flags().StringVarP(&flags.Credentials, "credentials", "c", "", "A path to the credentails json file issued by Google (Required). More details under help")
cmd.Flags().StringVarP(&flags.Credentials, "credentials", "c", "", "A path to the credentials json file issued by Google (Required). More details under help")
cmd.Flags().StringVarP(&flags.DocumentId, "document", "d", "", "The document id of the sheet to download (Required). Found in its url, e.g. https://docs.google.com/spreadsheets/d/<document-id>/edit#gid=0")
cmd.Flags().StringVarP(&flags.Format, "format", "f", "", "The format of the output, defaults to csv")
cmd.MarkFlagRequired("output")
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/lane_translations_download.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ lane translations download [flags]
### Examples

```
lane translations download -o output.csv -c googleapi.json -d 11p...ev7lc -f csv
lane translations download -o output.csv -c google-api.json -d 11p...ev7lc -f csv
```

### Options

```
-c, --credentials string A path to the credentails json file issued by Google (Required). More details under help
-c, --credentials string A path to the credentials json file issued by Google (Required). More details under help
-d, --document string The document id of the sheet to download (Required). Found in its url, e.g. https://docs.google.com/spreadsheets/d/<document-id>/edit#gid=0
-f, --format string The format of the output, defaults to csv
-h, --help help for download
Expand Down
3 changes: 2 additions & 1 deletion internal/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"strings"
)

// cSpell:disable
var validFormats = map[string]string{
"csv": "text/csv",
"tsv": "text/tab-separated-values",
"ods": "application/x-vnd.oasis.opendocument.spreadsheet",
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
}
} // cSpell:enable

func Download(ctx context.Context, flags *Flags) error {
service, err := newService(ctx, flags.Credentials)
Expand Down
14 changes: 7 additions & 7 deletions internal/downloader/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
)

var validationKases = []struct {
var validationCases = []struct {
name string
flags Flags
passes bool
Expand Down Expand Up @@ -65,7 +65,7 @@ var validationKases = []struct {
false,
},
{
"all-set-but-documentid",
"all-set-but-document-id",
Flags{
Output: "testdata/out.csv",
Credentials: "testdata/empty.json",
Expand Down Expand Up @@ -117,13 +117,13 @@ var validationKases = []struct {
}

func TestFlagsValidate(t *testing.T) {
for _, kase := range validationKases {
t.Run(kase.name, func(t *testing.T) {
err := kase.flags.validate()
if kase.passes && err != nil {
for _, c := range validationCases {
t.Run(c.name, func(t *testing.T) {
err := c.flags.validate()
if c.passes && err != nil {
t.Errorf("expected to pass, but got %v", err)
}
if !kase.passes && err == nil {
if !c.passes && err == nil {
t.Errorf("expected to fail, but got %v", err)
}
})
Expand Down
10 changes: 5 additions & 5 deletions internal/translations/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,13 @@ var validationCases = []struct {
}

func TestFlagsValidate(t *testing.T) {
for _, kase := range validationCases {
t.Run(kase.name, func(t *testing.T) {
err := kase.flags.validate()
if kase.passes && err != nil {
for _, c := range validationCases {
t.Run(c.name, func(t *testing.T) {
err := c.flags.validate()
if c.passes && err != nil {
t.Errorf("expected to pass, but got %v", err)
}
if !kase.passes && err == nil {
if !c.passes && err == nil {
t.Errorf("expected to fail, but got %v", err)
}
})
Expand Down