Skip to content

Commit 5547519

Browse files
committed
feat: Self-update
1 parent 1a90653 commit 5547519

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ Take the advantage of goodie commands like `phpctl create` to start a new projec
2727
sh <(wget -qO- https://raw.githubusercontent.com/opencodeco/phpctl/main/installer.sh)
2828
```
2929

30+
#### Update
31+
You can re-run the installer or use the `self-update` command:
32+
```shell
33+
phpctl self-update
34+
```
35+
3036
## Usage
3137
Then you can use `phpctl` or `pctl` with a subcommand:
3238
```shell
@@ -77,12 +83,13 @@ phpctl sh echo 'Hello, World!' # To run arbitrary sh commands inside the contain
7783
- `box`
7884

7985
### Helpers
80-
| Command | Description |
81-
|------------------------------|--------------------------------------------------------------|
82-
| `help` or `man` | Displays a help message. |
83-
| `doctor` | Inspects the current `PHP_VERSION` and `PHPCTL_IMAGE`. |
84-
| `build` | Builds the current `Dockerfile` (useful for custom images). |
85-
| `images` | Shows local `phpctl` images. |
86+
| Command | Description |
87+
|-----------------|-------------------------------------------------------------|
88+
| `help` or `man` | Displays a help message. |
89+
| `self-update` | Updates `phpctl` iself. |
90+
| `doctor` | Inspects the current `PHP_VERSION` and `PHPCTL_IMAGE`. |
91+
| `build` | Builds the current `Dockerfile` (useful for custom images). |
92+
| `images` | Shows local `phpctl` images. |
8693

8794
## The `.phpctlrc` file
8895
You can also add a `.phpctlrc` file at project's root directory with some overrides like:

src/help.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ help() {
3232
echo -e "\033[0;32m init [skeleton] \033[0m Initializes a skeleton configuration (phpunit, php-cs-fixer)"
3333
echo -e "\033[0;32m box \033[0m Runs Box (PHAR builder)"
3434
echo -e "\033[0;32m help or man \033[0m Displays this help message"
35+
echo -e "\033[0;32m self-update \033[0m Updates phpctl itself"
3536
echo -e "\033[0;32m doctor \033[0m Inspects the current PHP_VERSION and PHPCTL_IMAGE"
3637
echo -e "\033[0;32m build \033[0m Builds the current Dockerfile (useful for custom images)"
3738
echo -e "\033[0;32m images \033[0m Shows local phpctl images"

src/self-update.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
self-update() {
2+
echo -e "Heading to \033[33m$PHPCTL_DIR\033[0m to update..."
3+
cd $PHPCTL_DIR
4+
git pull origin HEAD
5+
echo -e "\033[32mUpdated!\033[0m"
6+
}

0 commit comments

Comments
 (0)