Skip to content

Commit

Permalink
Update changelog, readme. Update help copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
featheredtoast committed Oct 23, 2023
1 parent aaf7f11 commit 27b1fc5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.2.0 - 10-22-2023

- Add --tags and --skip-tags options

1.0.3 - 09-04-2021

- Started changelog - release to rubygems
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Usage: pups [options] [FILE|--stdin]
--stdin Read input from stdin.
--quiet Don't print any logs.
--ignore <elements> Ignore specific configuration elements, multiple elements can be provided (comma-delimited).
--tags <elements> Only run tagged commands.
--skip-tags <elements> Run all but listed tagged commands.
Useful if you want to skip over config in a pups execution.
e.g. `--ignore env,params`.
--gen-docker-run-args Output arguments from the pups configuration for input into a docker run command. All other pups config is ignored.
Expand All @@ -48,6 +50,32 @@ Running: `pups somefile.yaml` will execute the shell script resulting in a file

### Features

#### Filtering run commands by tags

The `--tags` and `skip-tags` argument allows pups to target a subset of commands listed in the somefile.yaml. To use this, you may tag your commands in the rublock. `--tags` will only run commands when commands have a matching tag. `skip-tags` will skip when commands have a matching tag.

Note, hooks from tagged commands will be present or absent depending on if the tag is filtered out or not as well. A command filtered out by targeting tag will also filter out the command's `before_` and `after_` hooks.

Example:

```
# somefile.yaml
run:
- exec:
cmd: /bin/bash -c 'echo hello >> hello'
tag: sometag
- exec:
cmd: /bin/bash -c 'echo hi >> hello'
tag: anothertag
- exec:
cmd: /bin/bash -c 'echo goodbye >> hello'
tag: thirdtag
```
Running: `pups --tags="sometag,anothertag" somefile.yaml` will not run the echo goodbye statement.

Running: `pups --skip-tags="sometag,anothertag" somefile.yaml` will ONLY run the echo goodbye statement.

#### Docker run argument generation

The `--gen-docker-run-args` argument is used to make pups output arguments be in the format of `docker run <arguments output>`. Specifically, pups
Expand Down
8 changes: 6 additions & 2 deletions lib/pups/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ def self.opts
"--gen-docker-run-args",
"Output arguments from the pups configuration for input into a docker run command. All other pups config is ignored."
)
opts.on("--tags <tag(s)>", Array, "Filter tagged commands.")
opts.on("--skip-tags <tag(s)>", Array, "Skip tagged commands.")
opts.on("--tags <tag(s)>", Array, "Only run tagged commands.")
opts.on(
"--skip-tags <tag(s)>",
Array,
"Run all but listed tagged commands."
)
opts.on("-h", "--help") do
puts opts
exit
Expand Down
2 changes: 1 addition & 1 deletion lib/pups/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Pups
VERSION = "1.1.1"
VERSION = "1.2.0"
end

0 comments on commit 27b1fc5

Please sign in to comment.