Coder Social home page Coder Social logo

ame's People

Stargazers

 avatar

Watchers

 avatar  avatar

ame's Issues

Add method of getting one methods options from another

One method should be able to get the options from another method so that it can easily call that method with the correct options. For example,

class T < Ame::Class
option 't'
option 'u'
def run(options)

end

options 'run' # or other method lookup spec, such as 'test:run'
option 'v'
def begin(options)
call 'run', nil, options if option['v']
end
end

Normalize name of Argument as well

The name of an Argument should be normalized as well, turning '_' into '-' for the user. This is true for Options and their aliases as well.

Unify Argument and Splat

Currently arguments and a possible splat are handled completely separately. It would be very nice if one wouldn’t have to treat splat separately, it simply being the last yielded value from #each and such. This would require making #process compatible, perhaps by checking the argument’s arity and either passing by #shift or a whole array. The same goes for displaying them.

Options disabling other options and arguments

Should #parse perhaps take options and processed arguments? This could be used
by Ample::Ame::Types::Project to determine if we’re looking for a project or a
directory, depending on if we’ve seen -p or --projects.

Another solution would be to add a :disable option to options that would allow
an option to disable an array of other options, given as strings, for example
'--projects', and arguments, given as symbols, for example, :project. This
information could potentially be used to output multiple usage lines. One
thing that speaks against this is that its both complicated to deal with
(probably requiring Arguments to know about Options) and it’s not good UI
design. It’s better to have

% ramex extract-project 12345-01 12345-02
% ramex extract //Filer/Projects/12345/01/… //Filer/Projects/12345/01/…

than

% ramex extract --projects 12345-01 12345-02
% ramex extract //Filer/Projects/12345/01/… //Filer/Projects/12345/01/…

I mean, even though the actual help output might be slightly longer it’s
immediately obvious that there are two separate methods available and that they
do different things and how to use them.

Processing splat arguments even though some fail

Many current tools continue processing arguments even though some might fail.
Touch(1) touches arguments even though some might fail:

% touch a /no/such/directory b
touch: cannot touch `/uaua/ua': No such file or directory

Here, both “a” and “b” have been touched.

Add 'help' option to all methods

All methods should take the 'help' option. Dispatch methods already do it, but action method don’t. It’s a simple matter of adding it to the constructor of Method. Then, whenever Method#call is invoked, check for options['help'] and, if present, use Help::Console (or whatever help utility has been selected) to display help for self, that is, the method.

Support dispatch with optional actions

Currently, any dispatches require the action argument. One way of supporting optional actions to a dispatch, thus making the dispatch itself a possible action, is to check if a method with the same name as the dispatch already exists on the class that’s gaining the dispatch. If so, unbind the method, mark 'action' as optional, and check whether 'action' is nil in the dispatch. If it is nil, then bind the method and call it.

method_added/inherited order is messed up in Ruby

class B < A
end

calls .inherited before any .method_added, whereas

B = Class.new(A) do
end

calls .inherited when the block is finished. We need to remove inherited and only call it once #initialize has been defined.

Ame::Class should have .usage

Ame::Class.usage should return an array of usage examples that will have the program name and class name prefixed when printed. The first example will be prefixed by "Usage: " and the rest with " or: " when printed. This will require Ame::Help::Console to take the class as an argument to its constructor.

Wrap lines in console help output

Lines wider than COLUMNS should be wrapped in the help output. They should be indented properly, too. This is quite complicated to get right, but worth it in the end.

Add handling of #initialize

Perhaps one way of solving this is simply to instantiate new objects each time and remove the Singleton stuff. Options to #initialize can always be set on the class for defaults. There’s really no need to only have one instance. Perhaps remove the restricted invocation of methods and add a subclass that only executes once for make-like task methods.

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.