Skip to content

Commit

Permalink
feat: Add the alias kxgr to containers-sugar (#75)
Browse files Browse the repository at this point in the history
* refactor: Add kxgr as an alias to containers-sugar

* add documentation
  • Loading branch information
xmnlab authored May 26, 2023
1 parent 9b10255 commit 67a9d5c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 47 deletions.
76 changes: 38 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,43 +60,43 @@ build:
smoke-tests:
set -ex
# group 1
containers-sugar --help
containers-sugar --version
containers-sugar build --verbose --group group1 --all
containers-sugar build --verbose --group group1
containers-sugar build --verbose --group group1 --services service1-1
containers-sugar pull --verbose --group group1 --all
containers-sugar pull --verbose --group group1
containers-sugar pull --verbose --group group1 --services service1-1
containers-sugar start --verbose --group group1 --all --options -d
containers-sugar restart --verbose --group group1 --all --options -d
containers-sugar exec --verbose --group group1 --service service1-1 --options -T --cmd env
containers-sugar stop --verbose --group group1 --all
containers-sugar run --verbose --group group1 --service service1-1 --options -T --cmd env
containers-sugar down --verbose --group group1
kxgr --help
kxgr --version
kxgr build --verbose --group group1 --all
kxgr build --verbose --group group1
kxgr build --verbose --group group1 --services service1-1
kxgr pull --verbose --group group1 --all
kxgr pull --verbose --group group1
kxgr pull --verbose --group group1 --services service1-1
kxgr start --verbose --group group1 --all --options -d
kxgr restart --verbose --group group1 --all --options -d
kxgr exec --verbose --group group1 --service service1-1 --options -T --cmd env
kxgr stop --verbose --group group1 --all
kxgr run --verbose --group group1 --service service1-1 --options -T --cmd env
kxgr down --verbose --group group1
# group 2
containers-sugar build --verbose --group group2 --all
containers-sugar build --verbose --group group2
containers-sugar build --verbose --group group2 --services service2-1
containers-sugar pull --verbose --group group2 --all
containers-sugar pull --verbose --group group2
containers-sugar pull --verbose --group group2 --services service2-1
containers-sugar start --verbose --group group2 --all --options -d
containers-sugar restart --verbose --group group2 --all --options -d
containers-sugar exec --verbose --group group2 --service service2-1 --options -T --cmd env
containers-sugar stop --verbose --group group2 --all
containers-sugar run --verbose --group group2 --service service2-1 --options -T --cmd env
containers-sugar down --verbose --group group2
kxgr build --verbose --group group2 --all
kxgr build --verbose --group group2
kxgr build --verbose --group group2 --services service2-1
kxgr pull --verbose --group group2 --all
kxgr pull --verbose --group group2
kxgr pull --verbose --group group2 --services service2-1
kxgr start --verbose --group group2 --all --options -d
kxgr restart --verbose --group group2 --all --options -d
kxgr exec --verbose --group group2 --service service2-1 --options -T --cmd env
kxgr stop --verbose --group group2 --all
kxgr run --verbose --group group2 --service service2-1 --options -T --cmd env
kxgr down --verbose --group group2
# group mix
containers-sugar build --verbose --group group-mix --all
containers-sugar build --verbose --group group-mix
containers-sugar build --verbose --group group-mix --services service1-1,service2-1
containers-sugar pull --verbose --group group-mix --all
containers-sugar pull --verbose --group group-mix
containers-sugar pull --verbose --group group-mix --services service1-1,service2-1
containers-sugar start --verbose --group group-mix --all --options -d
containers-sugar restart --verbose --group group-mix --all --options -d
containers-sugar exec --verbose --group group-mix --service service2-1 --options -T --cmd env
containers-sugar stop --verbose --group group-mix --all
containers-sugar run --verbose --group group-mix --service service2-1 --options -T --cmd env
containers-sugar down --verbose --group group-mix
kxgr build --verbose --group group-mix --all
kxgr build --verbose --group group-mix
kxgr build --verbose --group group-mix --services service1-1,service2-1
kxgr pull --verbose --group group-mix --all
kxgr pull --verbose --group group-mix
kxgr pull --verbose --group group-mix --services service1-1,service2-1
kxgr start --verbose --group group-mix --all --options -d
kxgr restart --verbose --group group-mix --all --options -d
kxgr exec --verbose --group group-mix --service service2-1 --options -T --cmd env
kxgr stop --verbose --group group-mix --all
kxgr run --verbose --group group-mix --service service2-1 --options -T --cmd env
kxgr down --verbose --group group-mix
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ configuration file. So the command line would be very simple.


The commands availables now are:
`help`, `version`, `build`, `down`, `get-ip`,
`--help`, `--version`, `build`, `down`, `get-ip`,
`logs`, `pull`, `restart`, `start`, `stop`, `wait`.

> Note: `get-ip` and `wait` are not yet implemented.
Expand Down Expand Up @@ -71,23 +71,27 @@ service-groups:
health-check: false
```
**NOTE**: containers-sugar has an convenient alias `kxgr` that helps to
keep the command line shorter, where **k** stands for *containers*,
**x** stands for *su* (*shu* sound), and **gr** stands for *gar*.
In another words, you can use `containers-sugar` or `kxgr` CLI.

Some examples of how to use it:

* build the defaults services (service1,service3) for group1:
`containers-sugar build --group group1`
`kxgr build --group group1`

* build the all services (there is no default service defined) for group2:
`containers-sugar build --group group2`
`kxgr build --group group2`

* build all services (ignore default) for group1:
`containers-sugar build --group group1 --all`
`kxgr build --group group1 --all`

* start the default services for group1:
`containers-sugar start --group group1`
`kxgr start --group group1`

* restart all services (ignore defaults) for group1:
`containers-sugar restart --group group1 --all`
`kxgr restart --group group1 --all`

* restart service1 and service2 for group1:
`containers-sugar restart --group group1 --services service1,service2`
`kxgr restart --group group1 --services service1,service2`
4 changes: 2 additions & 2 deletions containers_sugar/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

def _get_args():
parser = argparse.ArgumentParser(
prog='Containers-Sugar',
prog='containers-sugar',
description=(
'Containers-Sugar is a tool that help you to organize'
'containers-sugar (or kxgr) is a tool that help you to organize'
"and simplify your containers' stack."
),
epilog=(
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ exclude = [

[tool.poetry.scripts]
"containers-sugar" = "containers_sugar.__main__:app"
"kxgr" = "containers_sugar.__main__:app"


[tool.poetry.dependencies]
Expand Down

0 comments on commit 67a9d5c

Please sign in to comment.