JEG2 / highline

A higher level command-line oriented interface.
Other
1.29k stars 137 forks source link

Object Oriented Menus Proposal #89

Open mvastola opened 11 years ago

mvastola commented 11 years ago

Hi, I just wanted to touch base and see if the following functionality would be approved as a patch to this code base as I am planning to code it regardless and I want to gear it towards either being plugged directly into Highline or being its own add-on gem. (If the former is possible, I think it's important I talk to you guys beforehand to ensure I meet whatever constraints you want to impose.)

Basically, I want to code a way for something like this (input/output from use of 'checkinstall' menu editor) as the end result, but on the way there, a lot of features could easily be added that I think could make highline a bit more robust than it already is, for instance with wizards/workflows to fully describe the variables to be set in a class. Here's the screenshot: Checkinstall Menu Editor

Basically: I want the ability to see all the values for an object at a glance and be able to set any one of them individually. (If this is done, it's an insignificant amount of work to have the added feature of prompting for each value in sequence.) The only thing that this screenshot doesn't show that I'd like is the ability to abort changing a field, and also to re-set it to the default value.

I think the way I want to implement this is to accept classes that have some sort of ActiveModel-type class interface (though I would want this to be agnostic in terms of dependencies or the model's inhereted attributes, so I would just expect the provided class to respond to certain functions).

The benefit of this, is if "include Highline::Model" is added to the model, we can design our own methods like Model.wizard or Model.menu that could be called on it.

Any model would only need to have the following functionality defined:

We could additionally accept, but not require, the following methods to that model for more advanced features: (Say the column in question is 'name'.)

Please let me know what you guys think.

JEG2 commented 11 years ago

If I am understanding the request correctly, you want to add a feature where HighLine basically builds a menu system for modifying the properties of some object. Sure. This seems like a fine add on. I have no problem with adding it.

JEG2 commented 9 years ago

We are currently planning the next major version of HighLine. We will include a discussion of this issue in the plans we make for that release.