Giter Site home page Giter Site logo

Comments (8)

89luca89 avatar 89luca89 commented on May 14, 2024 1

That would break backwards compatibility as right now the distrobox-init script itself is mounted inside the container as entry point, and renaming it would break existing distroboxes

For now I see having both option active as the only way, having a distrobox command that manages subcommands and calls the dedicated scripts so that we have both ways
Then in the future we can think of a migration path

But I would like to maintain the code base as lean as possible, as the main target of the project was also this. Having smaller more readable files, easier to debug and modify
Instead of monolithic scripts of 2-3k LOCs which then will obviously become unmanageable

from distrobox.

89luca89 avatar 89luca89 commented on May 14, 2024

@TheEvilSkeleton I would like in the future to do something like this

But I want to maintain backward compatibility and I would like to avoid creating a single shell file with all inside because it would become quite unmanageable and unreadable

Any ideas?

Edit: one thing I like is also that the action of mounting the entry point/init in the container implies only having the init available inside of it, not the whole distrobox which is something I like a bit more

We could come up with a generic distrobox file that only manages the various subcommands and calls the dedicated files maybe?

from distrobox.

TheEvilSkeleton avatar TheEvilSkeleton commented on May 14, 2024

The only idea I have at the moment is making bash act like a compiled language, where all "libraries" (functions and such) get copied and prepended to the main bash script during install.

from distrobox.

manics avatar manics commented on May 14, 2024

You could make distrobox a wrapper script?

#!/bin/sh
set -eu
COMMAND="$1"
shift
exec distrobox-$COMMAND "$@"

With the added benefit that it handles new commands automatically.

from distrobox.

alegrey91 avatar alegrey91 commented on May 14, 2024

But I want to maintain backward compatibility and I would like to avoid creating a single shell file with all inside because it would become quite unmanageable and unreadable

I think you should create a sort of library and then use just a single file to avoid code duplication. It's better to have a single tool (in my opinion).

from distrobox.

89luca89 avatar 89luca89 commented on May 14, 2024

You could make distrobox a wrapper script?

#!/bin/sh
set -eu
COMMAND="$1"
shift
exec distrobox-$COMMAND "$@"

With the added benefit that it handles new commands automatically.

Yep that was the idea

But I want to maintain backward compatibility and I would like to avoid creating a single shell file with all inside because it would become quite unmanageable and unreadable

I think you should create a sort of library and then use just a single file to avoid code duplication. It's better to have a single tool (in my opinion).

The library approach could work in the future, but would break compatibility with existing distroboxes as the entry point is a mount of the distrobix-init file itself.

A sensible middle approach would be having single/separated files to do the stuff like now
And a distrobox script that will manage the subcommands (like @manics said)

This would enable also to use simple subcommands for quality of life (list, remove, clone, etc etc)

from distrobox.

89luca89 avatar 89luca89 commented on May 14, 2024

Started a first implementation of the wrapper and added a couple of quality of life commands like list and rm

from distrobox.

89luca89 avatar 89luca89 commented on May 14, 2024

I'm merging and closing this, if anyone has suggestions on including other quality of life commands just open a new issue 👍

from distrobox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.