mudler / luet

:package: :whale: 0-dependency Container-based Package Manager using SAT solver and QLearning
https://luet.io
GNU General Public License v3.0
266 stars 24 forks source link

Luet does expect some parameter or it crashes #297

Closed msdobrescu closed 2 years ago

msdobrescu commented 2 years ago

Luet version:

luet version 0.32.0-g2aa4c8a42ed13682b4820f3ca5e6d2388a5e2c24 2022-05-03

CPU architecture, OS, and Version:

Linux USC 5.15.38-mocaccino #5.15.38-Mocaccino SMP Fri May 13 15:51:02 UTC 2022 x86_64 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz GenuineIntel GNU/Linux

Describe the bug

Luet displays an internal error when run without parameters, as it expects at least one element in the arguments array.

To Reproduce

Run luet without any parameter

luet
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/mudler/luet/cmd/util.HandleLock()
        /luetbuild/luet/cmd/util/cli.go:67 +0x2d8
github.com/mudler/luet/cmd.Execute()
        /luetbuild/luet/cmd/root.go:122 +0x19
main.main()
        /luetbuild/luet/main.go:10 +0x17

Expected behavior

An user friendly message? A version info or about info? Help info? Similar to he message when --debug parameter is set alone:

Luet is a single-binary package manager based on containers to build packages. 

For documentation, visit https://luet.io.

To install a package:

        $ luet install package

To search for a package in the repositories:

$ luet search package

To list all packages installed in the system:

        $ luet search --installed .

To show hidden packages:

        $ luet search --hidden package

To build a package, from a tree definition:

        $ luet build --tree tree/path package

Usage:
  luet [command]

Available Commands:
  box             Manage luet boxes
  build           build a package or a tree
  cleanup         Clean packages cache.
  completion      generate the autocompletion script for the specified shell
  config          Print config
  create-repo     Create a luet repository from a build
  database        Manage system database (dangerous commands ahead!)
  entities        extension: entities (run to show the extension helper)
  filter          extension: filter (run to show the extension helper)
  geninitramfs    extension: geninitramfs (run to show the extension helper)
  help            Help about any command
  install         Install a package
  kernel-switcher extension: kernel-switcher (run to show the extension helper)
  oscheck         Checks packages integrity
  pack            pack a custom package
  package-browser extension: package-browser (run to show the extension helper)
  reclaim         Reclaim packages to Luet database from available repositories
  reinstall       reinstall a set of packages
  replace         replace a set of packages
  repo            Manage repositories
  search          Search packages
  serve-repo      Embedded micro-http server
  tree            Tree operations
  uninstall       Uninstall a package or a list of packages
  upgrade         Upgrades the system
  util            General luet internal utilities exposed

Flags:
      --color                     Enable/Disable color. (default true)
      --concurrency int           Concurrency (default 16)
      --config string             config file (default is $HOME/.luet.yaml)
  -d, --debug                     debug output
      --emoji                     Enable/Disable emoji. (default true)
      --enable-logfile            Enable log to file
      --fatal                     Enables Warnings to exit
  -h, --help                      help for luet
      --http-timeout int          Default timeout for http(s) requests (default 360)
      --live-output               Show live output during build (default true)
  -l, --logfile string            Logfile path. Empty value disable log to file.
      --no-spinner                Disable spinner.
      --plugin strings            A list of runtime plugins to load
  -q, --quiet                     quiet output
      --same-owner                Maintain same owner on uncompress. (default true)
      --skip-config-protect       Disable config protect analysis. (default true)
      --solver-attempts int       Solver maximum attempts (default 9000)
      --solver-discount float32   Solver discount rate (default 1)
      --solver-rate float32       Solver learning rate (default 0.7)
      --solver-type string        Solver strategy ( Defaults none, available: qlearning )
      --system-dbpath string      System db path
      --system-engine string      System DB engine
      --system-target string      System rootpath
  -v, --version                   version for luet

Use "luet [command] --help" for more information about a command.

Logs

Additional context

mudler commented 2 years ago

ouch, so sorry. I thought that was fixed already

msdobrescu commented 2 years ago

Not a problem, actually, I've thought you need to know.

joostruis commented 2 years ago

I was starting to get used to this. Think I'm going to miss it.

msdobrescu commented 2 years ago

I was starting to get used to this. Think I'm going to miss it.

@mudler, please break it back! :)

mudler commented 2 years ago