Add --delete-volume and --delete-volume-full
--delete-volume <name> removes a volume's config entry only. --delete-volume-full <name> also recursively deletes its host directory -- fails before touching the config if that deletion errors, so a failed directory delete never silently drops the config entry; warns instead of failing if the directory was already gone. Both are long-only, following the --list-volumes precedent, and slot into the existing multi-mode getopt dispatch the same way -v/--volume already does. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gv3s5jckJKzh6JkMoi2Akz
This commit is contained in:
@@ -59,6 +59,8 @@ slocker-lite -c|--cleanup <layer-id>
|
||||
slocker-lite -l|--list-images <directory>
|
||||
slocker-lite -v|--volume <name> <directory>
|
||||
slocker-lite --list-volumes
|
||||
slocker-lite --delete-volume <name>
|
||||
slocker-lite --delete-volume-full <name>
|
||||
slocker-lite -t|--test
|
||||
slocker-lite -h|--help
|
||||
slocker-lite -V|--version
|
||||
@@ -76,6 +78,8 @@ slocker-lite -V|--version
|
||||
| `-l, --list-images <dir>` | List OCI Image Layout tars (`*.tar`, `*.tar.*`) found directly in `<dir>`, with their `name:tag`. |
|
||||
| `-v, --volume <name> <dir>` | Create a named volume mapped to a host directory (created if missing), recorded in the config file's `volumes` section. Fails if the name or directory is already used by an existing volume. |
|
||||
| `--list-volumes` | List all named volumes (see `-v/--volume`) with their host directory. |
|
||||
| `--delete-volume <name>` | Remove a named volume from the config. The host directory is left untouched. |
|
||||
| `--delete-volume-full <name>` | Like `--delete-volume`, but also recursively deletes the volume's host directory. |
|
||||
| `-t, --test` | Print which `bwrap --unshare-xxx` namespaces the running kernel supports. |
|
||||
| `--log-level <level>` | Set log verbosity (`trace`, `debug`, `info`, `warn`, `error`, `critical`, `off`). |
|
||||
| `-h, --help` | Print usage and exit. |
|
||||
@@ -104,6 +108,12 @@ sudo ./buildDir/slocker-lite -r myimage.tar --user git
|
||||
|
||||
# List all named volumes
|
||||
./buildDir/slocker-lite --list-volumes
|
||||
|
||||
# Remove a named volume (keeps its host directory)
|
||||
./buildDir/slocker-lite --delete-volume mydata
|
||||
|
||||
# Remove a named volume and delete its host directory too
|
||||
./buildDir/slocker-lite --delete-volume-full mydata
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Reference in New Issue
Block a user