commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
821 stars 74 forks source link

`commander init` should be able to genearate a modular-style stub #20

Closed lebogan closed 8 years ago

lebogan commented 8 years ago

Is it possible to heve 'commander init' generate a modular-style stub? If not now, may I submit this as a new feature request?

Thank you for the great dsl.

Lewis

ggilder commented 8 years ago

Thanks, great suggestion. I've updated the title to be a little clearer.

lebogan commented 8 years ago

Please note: I am a network engtineer, not a software developer. I leave that to the pros.

That said, I managed to come up with a solution using bundler and commander. I have written a program using commander 'classic-style' to write a here-doc to a file in project_dir/exe. I used the commander source as an inspiration.

This solves my issue for now.

Thanks for this great software.

exe_name = ask('Name of executable: ').strip exe_description = ask 'Description of executable: ' exe_commands = ask_for_array 'List commands: ' exe_file = "#{project}/exe/#{exe_name}" begin File.open(exe_file, 'w') do f f.write <<-"...".gsub!(/^\s+ /, '') #!/usr/bin/env ruby
require 'rubygems'
require 'commander'
require "#{project}/version"
# Main class
class MyApplication
include Commander::Methods
# include whatever else you need
lebogan commented 8 years ago

This can probably be closed unless it's accepted as a future feature request.

Thanks.

ggilder commented 8 years ago

I don't have another way to track feature requests so leaving the issue open is fine. If you feel like attempting the patch to bin/commander go for it...

lebogan commented 8 years ago

Ok. I repeat - I'm not a software developer. I think I have something to submit as soon as I can figure out how to do a 'pull request?'. I committed my patch to lebogan/commander.

lebogan commented 8 years ago

I want to close this with the release of 4.4.0. Ok?

ggilder commented 8 years ago

Oops, good catch, closing!