Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature requests: command-line options, date entry #31

Open
archenemies opened this issue Aug 30, 2019 · 4 comments
Open

feature requests: command-line options, date entry #31

archenemies opened this issue Aug 30, 2019 · 4 comments

Comments

@archenemies
Copy link

I've used it for the first time and this is very useful!

Here are some feature requests I thought of:

  1. (a) Be able to specify all the search constraints on the command line.
    (b) Before showing the list of flights, print an example command line that will repeat the same search. This gives users an easy way to save searches

  2. When entering dates, "/" should move to the next field. Also, I would prefer for "up" and "down" arrows to move to the previous and next question, rather than incrementing and decrementing numbers. I don't know anyone who enters numbers in the terminal using arrows, I think it's always faster to type them. Also there is a problem where the number I type is not always recognized, I think this is because if I enter "5" for the day, and then change my mind and enter "7", it thinks I've typed "57" and ignores the "7".

One of the reasons I want to use this program is that I hate the date entry widgets on websites; they take a huge amount of time to load for some reason (my laptop is a bit old, but still), and they prevent me from just entering a date using my keyboard: 8/31/19 ... there, I typed it out in less than a second. It was slightly annoying that this program also tries to use a date widget of sorts, rather than just letting me type the date.

@jaebradley
Copy link
Owner

@archenemies thanks for the feedback!

Be able to specify all the search constraints on the command line.

This makes sense, but will probably take some work

Before showing the list of flights, print an example command line that will repeat the same search. This gives users an easy way to save searches

I'd probably put this behind a flag like --print-command or something.

Additionally, I could add a "save search" option - this would require a way to see all searches and remove any potentially irrelevant searches.

The two features could be implemented separately.

When entering dates, "/" should move to the next field. Also, I would prefer for "up" and "down" arrows to move to the previous and next question, rather than incrementing and decrementing numbers. I don't know anyone who enters numbers in the terminal using arrows, I think it's always faster to type them. Also there is a problem where the number I type is not always recognized, I think this is because if I enter "5" for the day, and then change my mind and enter "7", it thinks I've typed "57" and ignores the "7".

A lot of stuff to unpack here - I'm using some inquirer plugins, and this is some of the baked-in behavior.

Might be tough to implement the changes you've specified here, though I understand the pain-point around inputting dates.

@archenemies
Copy link
Author

Thank you.

Might be tough to implement the changes you've specified here, though I understand the pain-point around inputting dates.

Maybe an option: --dates-as-text?

@jaebradley
Copy link
Owner

@archenemies I just merged #35 (which should have been published as v1.1.0) which hopefully addresses the ability to specify options via the command line.

It does not support printing the command-line arguments for a given search (that's coming 😉 ).

Let me know your thoughts or if you run into any issues.

@archenemies
Copy link
Author

Thank you @jaebradley, your software is now even more useful to me.

I thought I'd compile a list of some observations I made while checking it out, rather than submitting separate issues:

  • npm install --global worked fine, however I was not able to compile the software using your new instructions, I got the following error when running the line in package.json:

      $ babel -d build/ src/ --ignore 'node_modules,*.test.js'
      ReferenceError: Unknown plugin "transform-runtime" specified in "/home/frederik/pkg-tmp/flights-search-cli/.babelrc" at 0, attempted to resolve relative to "/home/frederik/pkg-tmp/flights-search-cli"
          at /usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
          at Array.map (<anonymous>)
          at Function.normalisePlugins (/usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
          at OptionManager.mergeOptions (/usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
          at OptionManager.init (/usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
          at File.initOptions (/usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:212:65)
          at new File (/usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:135:24)
          at Pipeline.transform (/usr/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
          at transform (/usr/lib/node_modules/babel-cli/lib/babel/util.js:50:22)
          at Object.compile (/usr/lib/node_modules/babel-cli/lib/babel/util.js:59:12)
    
  • When there are no flights found, it would be nice to have a warning message and not just the default ? Choose trip (Use arrow keys).

  • To make it possible to supply the entire query on the command line, there should be an option which is opposite to "-d" ("+d"? "-D"? "-d0"? "--direct=no"?). For example when I run this command it asks me ? Select only direct flights? (y/N), even though I would prefer to specify the answer as "no" because I know there are no direct flights:

    flights search -l '2019-10-10|2019-10-20' -r '2019-10-20|2019-10-30' '-$' 2000 -s 'Jomo Kenyatta International' -e 'Beijing Capital International'
    
  • The error checking of command-line option syntax could be better, I found this confusing:

    $ flights search -l '2019-10-10|2019-10-20' -r -r '2019-10-20|2019-10-30' '-$' 2000                                           
    Rut ro - there was an error: TypeError: command.opts is not a function
    
  • You have two versions of this file, one seems old:

    src/formatters/formatDepartureWindow.js
    src/formatDepartureWindow.js
    
  • As the result list is a circular list, it would be helpful to have some indication that we have reached the bottom and are now cycling through again. I personally would make it non-circular, and just let the user type "Home" or "End" to get to the top and bottom of it. Otherwise the most expensive flight ends up next to the cheapest.

  • I only get four lines of search results, which isn't really a problem, but for example it could be expanded to fill $LINES on my terminal. When the output is not a terminal, I'd probably just print the whole list to STDOUT (and everything else to STDERR)

  • I think it would be cute to print the airport code when the airport is first selected, so it would look like this:

      ? Select origin Jomo Kenyatta International 🛫 (NBO)
    

    rather than this

      ? Select origin Jomo Kenyatta International 🛫
    

These are all minor I guess, anyway thank you for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants