davetron5000 / gli

Make awesome command-line applications the easy way
http://davetron5000.github.io/gli
Apache License 2.0
1.26k stars 102 forks source link

Namespace tree/array or similar #284

Closed IotaSpencer closed 5 years ago

IotaSpencer commented 5 years ago

I've gotten something like using walkers to walk the structure but I'm ending up overriding some of the GLI stuff as well, can we add a way to grab the current path to whichever command we are running instead of the only giving the name, like say if I had

pre do |global_options, command, options, args|
  SomeClass.some_class_method(command.path)
end

If input was 'memberships list', gli:memberships:list or $0:memberships:list separator wouldn't really matter as long as you could str.split using it, like "\n", "|", ":", "/" putting the path in a array would work as well, so like

[$0, 'memberships', 'list']

I know Command#parent has the command's ancestors and Command#commandshas its children, but beyond that, I basically would have to go recursive-happy to get all the variations

IotaSpencer commented 5 years ago

I just noticed Command#name_for_help.