-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the root command as an entry point for all commands to follow
- Loading branch information
Showing
8 changed files
with
656 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Test | ||
on: | ||
push: | ||
tags-ignore: | ||
- '**' | ||
branches: | ||
- '**' | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Test | ||
run: go test -v ./... | ||
|
||
golangci-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
|
||
goreleaser-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20 | ||
- uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
args: check | ||
|
||
release-dry-run: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
- name: Release Dry Run | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npx -p @semantic-release/changelog -p @semantic-release/git -p semantic-release \ | ||
semantic-release -d --branches ${GITHUB_REF##*/} |
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 |
---|---|---|
|
@@ -19,3 +19,5 @@ | |
|
||
# Go workspace file | ||
go.work | ||
|
||
litterrobot |
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,9 @@ | ||
branches: | ||
- main | ||
plugins: | ||
- '@semantic-release/commit-analyzer' | ||
- '@semantic-release/release-notes-generator' | ||
- '@semantic-release/changelog' | ||
- - '@semantic-release/git' | ||
- message: "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}" | ||
- '@semantic-release/github' |
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 +1,20 @@ | ||
# litterrobot | ||
# litterrobot | ||
A CLI for the Litter Robot 3. | ||
|
||
## Usage | ||
```console | ||
Control your Litter Robot 3 Connect | ||
|
||
Usage: | ||
litterrobot [command] | ||
|
||
Available Commands: | ||
completion Generate the autocompletion script for the specified shell | ||
config Manage local configuration for the CLI | ||
help Help about any command | ||
|
||
Flags: | ||
-h, --help help for litterrobot | ||
|
||
Use "litterrobot [command] --help" for more information about a command. | ||
``` |
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,29 @@ | ||
module github.com/tlkamp/litterrobot | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/spf13/cobra v1.7.0 | ||
github.com/spf13/viper v1.16.0 | ||
github.com/tlkamp/litter-api/v2 v2.1.0 | ||
) | ||
|
||
require ( | ||
github.com/fsnotify/fsnotify v1.6.0 // indirect | ||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/magiconair/properties v1.8.7 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/spf13/afero v1.9.5 // indirect | ||
github.com/spf13/cast v1.5.1 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.4.2 // indirect | ||
golang.org/x/sys v0.12.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
gopkg.in/ini.v1 v1.67.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
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,38 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
"path" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
lrc "github.com/tlkamp/litter-api/v2/pkg/client" | ||
) | ||
|
||
func newLitterRobotCmd(c *lrc.Client) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "litterrobot", | ||
Short: "Control your Litter Robot 3 Connect", | ||
PersistentPreRunE: func(_ *cobra.Command, _ []string) error { | ||
dir, err := os.UserHomeDir() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
configPath := path.Join(dir, ".litterrobot") | ||
|
||
viper.SetConfigName("config") | ||
viper.SetConfigType("yaml") | ||
viper.AddConfigPath(configPath) | ||
viper.ReadInConfig() | ||
return nil | ||
}, | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func Execute() error { | ||
var client *lrc.Client | ||
return newLitterRobotCmd(client).Execute() | ||
} |
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,9 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/tlkamp/litterrobot/internal/cmd" | ||
) | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |