* chore(repo): remove shell implementation
* chore(repo): remove bash completion for sub-commands
There is no need for separate files as there will be no dedicated binary
for sub-commands
* chore(repo): remove zsh completion for sub-commands
There is no need for separate files as there will be no dedicated binary
for sub-commands
* chore(repo): delete RFC
We are not using RFC at the moment
* chore(repo): move golang project to the root
* chore(ci): move golang project to the root
* chore(repo): use standard .gitignore for golang projects
source: https://github.com/github/gitignore/blob/main/Go.gitignore
* chore(ci): compatibility CI to handle a golang project
* refactor(ci): run shell script checks against the inside-distrobox files
* refactor(ci): merge ci.yml workflow into main.yml
* fix(assemble): start container only if the flag is provided
* test(containermanager): define mock
* feat(assemble): export apps
* test(assemble): fail on invalid app name
* feat(assemble): exported bins
* test(assemble): fail on invalid bin name
* test(rewrite): add shell-vs-Go compatibility test suite
Compares command generation and flag parity between shell distrobox and
the Go rewrite. Uses a single image (alpine:3.21) since all tests
operate at the command-generation level, not runtime.
Shell output is always the reference — if Go differs it's a failure,
not a skip. Go stderr is captured for diagnostics on flag rejections.
Container targeting is per-name only (no --all) to avoid interfering
with existing distroboxes.
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* fix add more tests
* fix add more tests
* fix add more tests
* fix(tests): fix malformed test cases in compare.sh
Three value-flag tests were broken by word splitting on unquoted
${flags} expansion — multi-word values caused trailing tokens to
clobber the container name:
- --additional-flags "--ulimit nofile=4096:4096" → --memory=512m
- --init-hooks "echo test-init-hook" → true
- --pre-init-hooks "echo test-pre-init-hook" → true
Also fix flag_slug computation (tr ' -' → tr ' -/:') in all four
loop sites so paths containing / or : don't create bogus filenames,
which silently broke the -H /tmp/dbx-test-home short-flag test.
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* fix: test refinement
remove version checks
remove ephemeral until we fix upstream
add test that surfaces go vs shell difference
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* fix: exclude SHLVL from checks, reduce noise
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* fix(test): remove some noise from env vars
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* chore: rename output file so that are grouped by operation
* chore(tests): fix linting issues and port comparison tests to POSIX sh
* chore(tests): apply shfmt
---------
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: balanza <emanuele@decup.is>
Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it>
Go rewrite emitted --userns keep-id without :size=65536 and
--platform <val> instead of --platform=<val>, diverging from the
shell reference implementation.
Sync assets internal shell with current upstream
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* refactor(enter): define command options
Refactor the `enter` command package so that adheres to the convention
to define its own arguments as options and read them in the Execute
method.
* refactor(containermanager): add InspectContainer to the public interface
* refactor(rm): move preflight checks in the command layer
That simplifies the containermanager.Remove interface and improve the
separation between the container manager and the presentation logic as
prompting it's not handled at containermanager level anymore.
It also improves efficiency as the userenv is fetch only once.
* refactor(ui): pass the prompter by reference
Use pointer to optimize memory footprint. It also allows nullable
references, hence a validation is required for the `rm` command when
executing on interactive mode.
* feat(ephemeral): add ephemeral command
The command is a composition of create, enter and rm commands.
It accepts the same arguments as the create command.
Add the stop command to stop executing containers. The command is a
wrapper of the container manager's stop feature.
If no container name is provided and the `--all` flag is not set, the
default container name is implied.
* add Exists function to containermanager
This public function tells if the container exists or not.
No output parsing is necessary, hence for performance we avoid using the
already-present InspectContainer function.
* fail if container with the same name already exists
* output error
Replace helper functions (lastString, lastBool, allStrings, splitString)
with a single loop that fetches ValueWithShadows() once per key. This
avoids repeated calls to the ini library for each field.
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
* move the Propter under screen package
* add color formatters
* add progress
This module allows for printing a sequence of lines with check marks.
Useful to show progress on a long running action (example: container
init).
* implement progess on create
* implement progress on assemble
* implement progress on enter
* implement color
* move internal/screen to pkg/ui
* add printer
* implement printer
* fix progress finalize method
* fix progress implementation for enter command
Manifest can either be file or remote URLs. In the latter case, the content is fetched into a temporary file; then the parsing follows as usual.
Note that the HTTP fetch has no constraint on protocol to use nor an allowed list of URLs, just like in the original `assemble` command. https://github.com/89luca89/distrobox/blob/main/distrobox-assemble#L240
```
if command -v curl > /dev/null 2>&1; then
download="curl --connect-timeout 3 --retry 1 -sLo"
elif command -v wget > /dev/null 2>&1; then
download="wget --timeout=3 --tries=1 -qO"
```
The only difference with the original implementation is that the file input is checked to be a valid URL.