Skip to content

Commit

Permalink
Add many new features and some small fixes (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
alajmo authored Dec 4, 2022
1 parent 62f5b3c commit f989a69
Show file tree
Hide file tree
Showing 160 changed files with 8,294 additions and 3,664 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
go: [1.18]
go: [1.19]

steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19

- name: Check out code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19

- name: Create release notes
run: ./scripts/release.sh
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NAME := sake
PACKAGE := github.com/alajmo/$(NAME)
DATE := $(shell date +%FT%T%Z)
GIT := $(shell [ -d .git ] && git rev-parse --short HEAD)
VERSION := v0.12.1
VERSION := v0.13.0

default: build

Expand All @@ -28,17 +28,15 @@ benchmark-save:

test:
# Unit tests
go test -v ./core/*.go -v
go test -v ./core/dao/*.go -v
go test -v ./core/...

# Integration tests
cd ./test && docker-compose up -d
go test -v ./test/integration/... -count=5 -clean
cd ./test && docker-compose down

unit-test:
go test -v ./core/*.go -v
go test -v ./core/dao/*.go -v
go test -v ./core/...

integration-test:
go test -v ./test/integration/... -clean
Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This readme is also accessible on [sakecli.com](https://sakecli.com/).

![demo](res/output.gif)

Interested in managing your git repositiories in a similar way? Check out [mani](https://github.com/alajmo/mani)!
Interested in managing your git repositories in a similar way? Check out [mani](https://github.com/alajmo/mani)!

## Table of Contents

Expand Down Expand Up @@ -78,7 +78,7 @@ Auto-completion is available via `sake completion bash|zsh|fish` and man page vi

### Building From Source

Requires [go 1.18 or above](https://golang.org/doc/install).
Requires [go 1.19 or above](https://golang.org/doc/install).

1. Clone the repo
2. Build and run the executable
Expand Down Expand Up @@ -133,7 +133,7 @@ TASK ping: Pong ************
0.0.0.0 | pong
# Count number of files in each server in parallel
$ sake exec --all --output table --parallel 'find . -type f | wc -l'
$ sake exec --all --output table --strategy=free 'find . -type f | wc -l'
Server | Output
-----------+--------
Expand All @@ -150,10 +150,22 @@ Check out the [examples page](/docs/examples.md) for more advanced examples and
- [Recipes](docs/recipes.md)
- [Config Reference](docs/config-reference.md)
- [Command Reference](docs/command-reference.md)
- Documentation
- [Inventory](docs/inventory.md)
- [Task Execution](docs/task-execution.md)
- [Error Handling](docs/error-handling.md)
- [Variables](docs/variables.md)
- [Working Directory](docs/work-dir.md)
- [Output](docs/output.md)
- Project
- [Background](docs/background.md)
- [Roadmap](docs/roadmap.md)
- [Ansible](docs/ansible.md)
- [Performance](docs/performance.md)
- Development
- [Development](docs/development.md)
- [Contributing](docs/contributing.md)
- [Changelog](docs/changelog.md)
- [Roadmap](docs/roadmap.md)
- [Project Background](docs/project-background.md)
- [Contributing](docs/contributing.md)

## [License](LICENSE)

Expand Down
2 changes: 1 addition & 1 deletion cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PowerShell:
# and source this file from your PowerShell profile.
`,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
Run: generateCompletion,
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func describeCmd(config *dao.Config, configErr *error) *cobra.Command {
cmd := cobra.Command{
Aliases: []string{"desc"},
Use: "describe <servers|tasks>",
Short: "Describe servers and tasks",
Long: "Describe servers and tasks.",
Short: "Describe servers, tasks, specs and targets",
Long: "Describe servers, tasks, specs and targets",
Example: ` # Describe servers
sake describe servers
Expand Down
7 changes: 3 additions & 4 deletions cmd/describe_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ func describeServersCmd(config *dao.Config, configErr *error) *cobra.Command {
return values, cobra.ShellCompDirectiveNoFileComp
},
}

cmd.Flags().StringVarP(&serverFlags.Regex, "regex", "r", "", "filter servers on host regex")

cmd.Flags().BoolVarP(&serverFlags.Invert, "invert", "v", false, "invert matching on servers")
cmd.Flags().SortFlags = false

cmd.Flags().StringSliceVarP(&serverFlags.Tags, "tags", "t", []string{}, "filter servers by their tag")
err := cmd.RegisterFlagCompletionFunc("tags", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
Expand All @@ -53,6 +50,8 @@ func describeServersCmd(config *dao.Config, configErr *error) *cobra.Command {
})
core.CheckIfError(err)

cmd.Flags().StringVarP(&serverFlags.Regex, "regex", "r", "", "filter servers on host regex")
cmd.Flags().BoolVarP(&serverFlags.Invert, "invert", "v", false, "invert matching on servers")
cmd.Flags().BoolVarP(&serverFlags.Edit, "edit", "e", false, "edit server")

return &cmd
Expand Down
1 change: 1 addition & 0 deletions cmd/describe_specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func describeSpecsCmd(config *dao.Config, configErr *error) *cobra.Command {
},
DisableAutoGenTag: true,
}
cmd.Flags().SortFlags = false

cmd.Flags().BoolVarP(&specFlags.Edit, "edit", "e", false, "edit spec")

Expand Down
1 change: 1 addition & 0 deletions cmd/describe_targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func describeTargetsCmd(config *dao.Config, configErr *error) *cobra.Command {
},
DisableAutoGenTag: true,
}
cmd.Flags().SortFlags = false

cmd.Flags().BoolVarP(&targetFlags.Edit, "edit", "e", false, "edit target")

Expand Down
2 changes: 2 additions & 0 deletions cmd/describe_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func describeTasksCmd(config *dao.Config, configErr *error) *cobra.Command {
DisableAutoGenTag: true,
}

cmd.Flags().SortFlags = false

cmd.Flags().BoolVarP(&taskFlags.Edit, "edit", "e", false, "edit task")

return &cmd
Expand Down
4 changes: 2 additions & 2 deletions cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func editCmd(config *dao.Config, configErr *error) *cobra.Command {
}

cmd.AddCommand(
editTask(config, configErr),
editServer(config, configErr),
editSpec(config, configErr),
editTask(config, configErr),
editTarget(config, configErr),
editSpec(config, configErr),
)

return &cmd
Expand Down
Loading

0 comments on commit f989a69

Please sign in to comment.