Skip to content

Commit

Permalink
Move CLI command to /cmd/shoutrrr
Browse files Browse the repository at this point in the history
This will make the CLI command installable by running:

```
go install github.com/containrrr/shoutrrr/shoutrrr@latest
```

When installing using `go install` previously the command got installed
with the binary name `cli`.
  • Loading branch information
arnested committed Dec 29, 2021
1 parent e46ecc1 commit 7fe1458
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*.dll
*.so
*.dylib
/shoutrrr
/shoutrrr/shoutrrr

# Test binary, build with `go test -c`
# ---
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ FROM scratch
COPY --from=alpine \
/etc/ssl/certs/ca-certificates.crt \
/etc/ssl/certs/ca-certificates.crt
COPY shoutrrr /
COPY shoutrrr/shoutrrr /

ENTRYPOINT ["/shoutrrr"]
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

go build -o ./shoutrrr ./cli
go build -o ./shoutrrr/shoutrrr ./shoutrrr
7 changes: 7 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Usage:
Possible actions: send, verify, generate
```

On a system with Go installed you can install the latest Shoutrrr CLI
command with:

```shell
go install github.com/containrrr/shoutrrr/shoutrrr@latest
```

### Commands

#### Send
Expand Down
2 changes: 1 addition & 1 deletion generate-service-config-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function generate_docs() {
DOCSPATH=./docs/services/$SERVICE
echo -en "Creating docs for \e[96m$SERVICE\e[0m... "
mkdir -p "$DOCSPATH"
go run ./cli docs -f markdown "$SERVICE" > "$DOCSPATH"/config.md
go run ./cmd/shoutrrr docs -f markdown "$SERVICE" > "$DOCSPATH"/config.md
if [ $? ]; then
echo -e "Done!"
fi
Expand Down
2 changes: 1 addition & 1 deletion goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build:
dir: .
main: ./cli
main: ./shoutrrr
binary: shoutrrr
goos:
- linux
Expand Down
8 changes: 5 additions & 3 deletions cli/cmd/docs/docs.go → shoutrrr/cmd/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import (
"github.com/containrrr/shoutrrr/pkg/router"
"github.com/spf13/cobra"

cli "github.com/containrrr/shoutrrr/cli/cmd"
f "github.com/containrrr/shoutrrr/pkg/format"
cli "github.com/containrrr/shoutrrr/shoutrrr/cmd"
)

var serviceRouter router.ServiceRouter
var services = serviceRouter.ListServices()
var (
serviceRouter router.ServiceRouter
services = serviceRouter.ListServices()
)

// Cmd prints documentation for services
var Cmd = &cobra.Command{
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions cli/cmd/send/send.go → shoutrrr/cmd/send/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (

"github.com/spf13/cobra"

cli "github.com/containrrr/shoutrrr/cli/cmd"
u "github.com/containrrr/shoutrrr/internal/util"
"github.com/containrrr/shoutrrr/pkg/router"
"github.com/containrrr/shoutrrr/pkg/types"
"github.com/containrrr/shoutrrr/pkg/util"
cli "github.com/containrrr/shoutrrr/shoutrrr/cmd"
)

// Cmd sends a notification using a service url
Expand Down Expand Up @@ -82,5 +82,4 @@ func Run(cmd *cobra.Command, _ []string) {
}

os.Exit(exitCode)

}
File renamed without changes.
13 changes: 7 additions & 6 deletions cli/main.go → shoutrrr/main.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package main

import (
cli "github.com/containrrr/shoutrrr/cli/cmd"
"github.com/containrrr/shoutrrr/cli/cmd/docs"
"github.com/containrrr/shoutrrr/cli/cmd/generate"
"github.com/containrrr/shoutrrr/cli/cmd/send"
"github.com/containrrr/shoutrrr/cli/cmd/verify"
"os"

"github.com/containrrr/shoutrrr/internal/meta"
cli "github.com/containrrr/shoutrrr/shoutrrr/cmd"
"github.com/containrrr/shoutrrr/shoutrrr/cmd/docs"
"github.com/containrrr/shoutrrr/shoutrrr/cmd/generate"
"github.com/containrrr/shoutrrr/shoutrrr/cmd/send"
"github.com/containrrr/shoutrrr/shoutrrr/cmd/verify"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
)

var cmd = &cobra.Command{
Expand Down

0 comments on commit 7fe1458

Please sign in to comment.