Coder Social home page Coder Social logo

ess / belafonte Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 99 KB

Jump in the command line with the master of CLIpso (yet another CLI command suite library, which is basically usable right now, but needs much better documentation)

License: MIT License

Ruby 99.83% Shell 0.17%

belafonte's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ehowe

belafonte's Issues

Handle options

Options are flags that take an argument. A good example of this is the -i flag for ssh.

Documentation

The README is a good start, but the DSL, the helpers, and the special methods (handle, setup) need proper documentation.

Additionally, the fact that command-line help (-h/-help) is generated automatically needs to be mentioned, at the least.

Handle switches

Switches are flags that represent a boolean.

For example, the -n flag for the echo builtin is a switch.

Mounting app never handles a command line

As it stands right now, the handle method for OuterApp in the following example never has a chance to execute:

require 'belafonte'

class InnerApp < Belafonte::App
  title "inner"

  def handle
    stdout.puts "This is the inner app"
  end
end

class OuterApp < Belafonte::App
  title "outer"

  mount InnerApp

  def handle
    stdout.puts "This is the outer app"
  end
end

exit OuterApp.new(ARGV).execute!

Tests

There are still untested artifacts of the initial experiment lingering in the code. They need to either be removed or tested.

Arg processing prevents --help

The internals of execute! currently process the flags, then the args, then handles them.

The problem with this is that processing the args before handling -h/--help prevents the help action from happening.

Two possible solutions:

  • handle help specifically before handling args
  • enable help when arg errors are raised

App doesn't always return an integer

So, with the run pattern that we have, App#execute! _must_ always return an integer (0 for success, >0 for failure). As it stands now, That isn't always guaranteed to be the case, and that breaks the basic contract of the whole damn thing.

Need to figure out a way to ensure that this always happens, Additionally, caveats need to be added to the documentation to explain that if the app uses Kernel.exit, we're not responsible for the app's exit status.

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.