FAQ
I'm trying to make a busybox style program, one that can by symlinked to
various linked executables named after the subcommands of the main program.

For example, we might be able to call the program as "busybox help," or you
could create a symlink called 'help' that points to the busybox executable.
  When executed, ./help should execute as if it was the only available
command, its own help page, etc. So, busybox needs to be able to determine
how it was called, and execute the subcommand as if it the "root" command.

I've been looking at different cli argument parsing packages and techniques
and haven't seen anything that matches up easily with this style of
development. I think I can mange to get cobra to do this, but I'm
wondering if there is anything out there already that is doing this, or any
example projects on how best to do this in go.

Thanks,

Ben

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Tamás Gulácsi at Dec 2, 2015 at 5:20 am
    Just decide which root cmd's Execute you call by switching on OS.Args[0].

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Staven at Dec 2, 2015 at 7:23 am

    On Tue, Dec 01, 2015 at 08:30:55PM -0800, Benjamin Bytheway wrote:
    I've been looking at different cli argument parsing packages and techniques
    and haven't seen anything that matches up easily with this style of
    development.
    How about a switch and the flag package?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Wojciech S. Czarnecki at Dec 2, 2015 at 9:33 am
    Dnia 2015-12-01, o godz. 20:30:55
    Benjamin Bytheway <bbytheway@gmail.com> napisał(a):
    I'm trying to make a busybox style program, one that can by symlinked to
    various linked executables named after the subcommands of the main program.
    https://github.com/rekby/multiex

    --
    Wojciech S. Czarnecki
            ^oo^ OHIR-RIPE

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Benjamin Bytheway at Dec 3, 2015 at 6:02 am
    Thanks for the links and advice. I think I fell into the classic trap of looking for a third party package, instead of Go itself and the standard library. I should have known better.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Sebastien Binet at Dec 3, 2015 at 8:23 am

    On Thu, Dec 3, 2015 at 7:02 AM, Benjamin Bytheway wrote:
    Thanks for the links and advice. I think I fell into the classic trap of looking for a third party package, instead of Go itself and the standard library. I should have known better.
    BTW, I (and others) have extracted the bits and pieces from the go
    stdlib that power the go-tool into:
      https://github.com/gonuts/commander

    -s

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 2, '15 at 4:33a
activeDec 3, '15 at 8:23a
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase