Commit Graph
1744 Commits
Author SHA1 Message Date
Luca Di Maio 83aecc269f feat(enter): support custom commands, fix TTY detection and flag parsing (#47) 2026-06-14 13:04:27 +02:00
Luca Di Maio 75c5e39640 fix(ephemeral): add dry-run flag
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 96974f71a0 fix(podman): fix constant lint
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio ed61cd0c4d fix(enter): add missing dry run
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 2d010dde14 fix(podman): empty DBX_CONTAINER_MANAGER should default to podman
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio 792dfd20cc fix(podman): add missing Commit implementation
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
Luca Di Maio d7c0b3cd81 fix(create): behave like shell, use containerName as default hostname on unsharenetns
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:27 +02:00
balanza 847ec6fc13 feat(containermanager): add suppoer to podman static 2026-06-14 13:04:27 +02:00
balanza ea9503c3e6 chore(lint): ignore duplication for podman container containermanager 2026-06-14 13:04:27 +02:00
balanza 46ece43968 feat(containermanager): add podman support 2026-06-14 13:04:27 +02:00
dependabot[bot] 63c22522f8 build(deps): bump actions/checkout from 6.0.1 to 6.0.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-14 13:04:27 +02:00
dependabot[bot] b04758c28f build(deps): bump actions/setup-go from 6.1.0 to 6.2.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.1.0 to 6.2.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/4dc6199c7b1a012772edbd06daecab0f50c9053c...7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-14 13:04:27 +02:00
balanza eea4ce9315 refactor(create): reduce command function complexity 2026-06-14 13:04:27 +02:00
balanza 31c4efa7ec feat(create): handle clone flag
Distroboxes using `--clone` flag will be created from the given existing
container. A new image is committed using the container as a base.
2026-06-14 13:04:27 +02:00
balanza 3b1c865ac9 feat(containermanager): add commit command 2026-06-14 13:04:27 +02:00
balanza 2c54e1746d feat(containermanager): parse container ID from inspect data 2026-06-14 13:04:27 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 90f914a14a build(deps): bump actions/checkout from 5.0.1 to 6.0.1 (#37)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.1 to 6.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5.0.1...v6.0.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-14 13:04:27 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 9a188438c0 build(deps): bump golangci/golangci-lint-action from 9.1.0 to 9.2.0 (#38)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 9.1.0 to 9.2.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/e7fa5ac41e1cf5b7d48e45e42232ce7ada589601...1e7e51e771db61008b38414a730f564565cf7c20)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: 9.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 90a9a64c76 feat(ephemeral): implement ephemeral command (#34)
* 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.
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 4107ec9cf3 feat(stop): add stop command (#36)
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.
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 6f5a541732 fix(enter): remove wrong early return (#35) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 09294e2264 feat(create): abort create if the container already exists (#28)
* 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
2026-06-14 13:04:27 +02:00
balanza 2da62dafdc fix: add complete message 2026-06-14 13:04:27 +02:00
Fabrizio Sestito 31ceeb1074 fix(manifest): use recursive includes resolver to detect circular dependencies
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Fabrizio Sestito 861a1a7504 perf(manifest): reduce allocations in sectionToItem
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>
2026-06-14 13:04:27 +02:00
Fabrizio Sestito 1ed885cbf0 chore(manifest): rename tests to something more idiomatic
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Fabrizio Sestito 6d6afebb2d refactor: simplify manifest parsing with iniv1 library
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:27 +02:00
Emanuele De Cupis e90eab44a3 chore: introduce ui package (#31)
* 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
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 7a49a645aa feat(assemble): implement rm and replace (#27) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 974aacf5fc chore(rm): refactor options passing (#26) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis f4b876dca2 fix(rm): remove only distrobox (#25) 2026-06-14 13:04:27 +02:00
Alessio Biancalana cd919f684c feat(rm): rewrite in go (#23)
* feat: rewrite rm in go

* fix: declare yes and no as string slices
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 73bc4bc141 feat(assemble): fetch remote manifest (#24)
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.
2026-06-14 13:04:27 +02:00
Emanuele De Cupis cfb8ab06de feat(assemble): implement create with assemble (#20)
* scaffold assemble command

* mount assemble command

* implement create item
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 3ba0ba350c fix: increase since timestamp at every iteration (#22) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis 5930201257 fix(create): fix argument passing (#21) 2026-06-14 13:04:27 +02:00
Emanuele De Cupis d1308fda97 fix(assemble): refine manifest item type (#19)
* remove unused ID field

* add a test for include order
2026-06-14 13:04:27 +02:00
Emanuele De Cupis 16ceec4dc2 feat(create): generate desktop entry on create (#17)
* read desktop entry directory and distrobox path from the global config

* implement entry generation requested from user
2026-06-14 13:04:17 +02:00
Emanuele De Cupis 04d3d006fb feat: parse manifest files (#18) 2026-06-14 12:58:04 +02:00
Alessio Biancalana d92dfe2f5c feat(enter): rewrite in go (#12)
* feat(enter): rewrite in go

* chore: make InspectContainer public

* chore: use userenv package for user's environment

* chore: export InspectResult type for convenience

* fix: rename containerInspect to inpectOutput

* fix: use userenv inside generateEnterCommand

* fix(enter): more userenv

* chore: add some unit tests for buildContainerPath and buildCommandArgs
2026-06-14 12:58:04 +02:00
Fabrizio Sestito a2c0508641 feat: add config (#15)
* feat: add config

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

* build(deps): add testify

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

* test(config): add config loading test

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

---------

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 12:58:04 +02:00
Emanuele De Cupis ed9692fc1c chore: refactor run (#16) 2026-06-14 12:58:04 +02:00
Emanuele De Cupis 6ce7bf6cc6 feat: create command (#14)
* embed shell scripts to execute inside the distrobox

The command init, export and host-exec must be accessible from inside
the distrobox container.
When needed, the embedded scripts will be written to a host directory
and then mounted as volume on the created container.
The host directory is determined by configuration and environment
variables.
The script will be not converted to GO to keep then
architecture-agnostic.

* add Create to the Docker container manager

The function will compose argument string to append to the `docker`
command.
If `DryRun=true`, the command is just printed on screen and not
executed.

* add Create command package

* mount cli command
2026-06-14 12:58:04 +02:00
Alessio Biancalana 91ae6568e0 fix: generate-entry tests against new docker interface (#13) 2026-06-14 12:58:04 +02:00
Emanuele De Cupis 4a7d83bfe7 feat: generate-entry command (#7)
* add GenerateEntryCommand package

The package mimics the actual distrobox-generate-entry shell command
that installs a desktop entry file so that the host's desktop
environment can render the appropriate application icon.
This first implementantion scaffolds the command package and implements
the simplest scenario for a single container.

* delete entry

If the `delete` flag is provided, the command remove the desktop entry
if present.
Deleting a non-existing item does not raise an error.

* generate entries for all containers

With `opts.All` we implement an abstraction over the
`GenerateEntryCommand` that iterates across all the containers to
generate or delete the relative desktop entries.
`ListCommand` is used to fetch the list of containers.

* mount the generate-entry cli command

Mount the command so that is reachable from the CLI. Define parameters
with type and basic validation.
Depending on the flag `--all`, the appropriate set of options is provided
to the `GenerateEntryCommand.Execute()` method.
If `--all` is set, `container-name` and `icon` arguments will be ignored.
2026-06-14 12:58:04 +02:00
Fabrizio Sestito d81390bd73 feat: validate sudo before command (#10)
* feat(cli): validate sudo (sudo -v) in beforeCommand if --root is set

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

* feat(docker): add root and sudoCommand and execute commands with sudo if root is set

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

* feat(cli): add --root description and -r alias

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>

---------

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 12:58:04 +02:00
dependabot[bot] 0e67950c32 build(deps): bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-14 12:58:04 +02:00
Emanuele De CupisandAlessio Biancalana bf8a6f8870 chore: add ci for rewrite project (#9)
* chore: disable mdlint (#6)

* resolve lint issues

Some issues where detected by the CI once run:
* use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
* File is not properly formatted (goimports)
* Magic number: 12, in <condition> detected (mnd)
* error-format: fmt.Errorf can be replaced with errors.New (perfsprint)

---------

Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it>
2026-06-14 12:58:04 +02:00
Emanuele De Cupis 4547c5eb2a chore: add rfc 0001 for golang rewrite (#5) 2026-06-14 12:58:04 +02:00
Emanuele De Cupis c74e9144b4 fix: formatting (#8) 2026-06-14 12:57:57 +02:00