opentraveldata / geobases

Data services and visualization
http://opentraveldata.github.com/geobases/
Other
193 stars 41 forks source link

Interactive mode #9

Closed alexprengere closed 11 years ago

alexprengere commented 11 years ago

I think it would be interesting to have a interactive mode where you just answer questions like:

Some additional questions may be asked if necessary. At the end, the query is run, and the user get the one-liner he could have typed to get it directly.

I believe this could make the CLI more accessible for new users, and provide a way to learn and understand it.

Concretely:

$ GeoBase --ask # whatever :)
Type of search: exact
Field: name
Value: paris
Display [terminal]: quiet

One-liner:
GeoBase -E name -e paris --quiet

Results...
alexprengere commented 11 years ago

I shipped this feature on the develop branch, and this is also available on GeoBasesDev channel.

The original idea has been used, here is an example:

$ GeoBase --ask # or -a
-----------------------------------------------------
               WELCOME TO LEARNING MODE

            You will be guided through the
           possibilities by answering a few
                     questions.
-----------------------------------------------------

[1/5] Which data source do you want to work with? 
[2/5] Consider all data for this source [Y/N]? Y
[3/5] What kind of filter? 
[4/5] On which field?
[   ] Which value to look for? 
[5/5] Which display? 

-----------------------------------------------------
            Equivalent one-liner command             
        with long options and short options          
                      Run it!                        

GeoBase --base airlines --fuzzy-field name --fuzzy "air asia" --quiet
GeoBase -b airlines -F name -f "air asia" -q
-----------------------------------------------------

The user is guided through some questions, and at the end he gets the command to run.