You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2011/01/27 08:36:44 UTC

[jira] Updated: (KARAF-220) provide a text entry option with remembered default values for 'wizard' like commands

     [ https://issues.apache.org/jira/browse/KARAF-220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated KARAF-220:
----------------------------------

    Fix Version/s:     (was: 2.2.0)

> provide a text entry option with remembered default values for 'wizard' like commands
> -------------------------------------------------------------------------------------
>
>                 Key: KARAF-220
>                 URL: https://issues.apache.org/jira/browse/KARAF-220
>             Project: Karaf
>          Issue Type: New Feature
>          Components: console
>            Reporter: james strachan
>
> For example, imagine a command line "mvn release:prepare" or imagine a simple command which creates a new Java source file using some kind of template. You might want to allow folks to specify the package name to use, or release number to use for a command using an option. But if the option isn't supplied you might want to prompt the user with a guessed default value - which may well be fine most of the time, so users can just type 'enter' to accept the default, or provide a new value.
> e.g..
> imagine a "foo create mdb" command which creates a Message Driven Bean java class. If the user types the following in the console....
> {code}
> $ foo create mdb bar
> Creating Message Driven Bean  class Bar
> package: [org.acme.foo]: _
> {code}
> if the user hits enter, then the default value is accepted otherwise they can enter the value. Just like with "mvn release" where the plugin guesses decent values for all the options.
> Lets say the user enters "org.acme.foo.mdb" as the value then creates another MDB...
> {code}
> $ foo create mdb bar
> Creating Message Driven Bean  class Bar
> package: [org.acme.foo]: org.acme.foo.mdb
> Created MDB in org.acme.foo.mdb.Bar
> $ foo create mdb another
> package: [org.acme.foo.mdb]: _
> {code}
> Here the system has remembered what the user typed for an option so it can be defaulted in the next time.
> So given all the nice injection & annotations stuff in the Karaf console; I'm wondering if we can reuse the same options to from inside the execution of a command, be able to ask the user for an option (if it was not specified in the original command line) showing a default value - which if required can also be saved using the User Preferences stuff.
> something along the line of...
> public interface EntryForm {
>   public boolean promptUser(Action action, String optionName, String prompt);
> }
> with maybe a separate API for use when the users response should be remembered in UserPreferences for next time the user executes a similar command.
> A great use case for the 'remembering' is when we create commands which code generate XML or Java code into a directory or package; which will likely remain the same for a project, but we may generate multiple instances of the same kind of thing. e.g. like creating entities or controllers in Rails, creating RouteBuilders in Camel or whatever
> UserPreferences stuff here:
> http://download.oracle.com/javase/1.5.0/docs/guide/preferences/index.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.