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

Implement an interactive CLI #17

Closed
bnvk opened this issue Feb 27, 2015 · 7 comments
Closed

Implement an interactive CLI #17

bnvk opened this issue Feb 27, 2015 · 7 comments

Comments

@bnvk
Copy link
Owner

bnvk commented Feb 27, 2015

Currently Conjuror runs as just as a one time command with args. In order to implement #3 an interactive CLI is absolutely required!

@simonv3
Copy link
Contributor

simonv3 commented Dec 9, 2015

These thoughts popped into my head just now:

With the idea that conjuror is a data processing tool, and not just an hour tracker, I feel like ideally the CLI would be

$ conjuror cast track

which would cast the "track" spell (the current track command)

this would be sibling to:

$ conjuror recipe track

which would step the user through creating their own spells - "track" in this case. This set up process would basically build use a JSON schema to manage CSVs. We could provide a couple of commands as examples (track, hours-sheet), and recipes could be easily shared or plugged into a recipe folder.

I'm thinking along the lines of "what do I want this flow to look like" and then we could go from there, rather than worrying what the architecture of the spell is going to be. Let's start with doing a single CLI command that combines track and getting hours, then see if we can automagically create the track recipe (ie $ conjuror recipe track).

Thoughts?

@bnvk
Copy link
Owner Author

bnvk commented Jan 9, 2016

@simonv3 yo dawg, check it. After merging in your changes, I tinkered around with things a bit. Changes of note as per your work towards recipes and this issue, of which there is overlap:

  • Tidied up some redundancies in Conjuror.Grow() method and elsewhere
  • The CLI now has multiple colors when generating a report
  • I created cli/ directory whereby to store CLI interfaces
  • Moved both track.js and setup.js into this cli/ directory
  • Created a script called cli/output.js that walks a user through generating a report

Note: that last point doesn't quite work ATM as it fails to actually do the data processing. That said, I think this is heading in the right direction.

However, i'm unsure if we're fully synced up with the "recipes" idea in how we both conceive it! We should probably try to chat at some point!

bnvk added a commit that referenced this issue Jan 12, 2016
bnvk added a commit that referenced this issue Jan 12, 2016
@bnvk
Copy link
Owner Author

bnvk commented Jan 12, 2016

@simonv3 slightly more tinkering and we now have a ctrack command that you don't need to pass any args to and it will autoload your CSV and such. Personally, this makes me 200% more likely to track things more regularly as it's much less effort to type into the CLI now. If you're keen to tinker or follow these changes, check the full-fledged-cli branch and add an array of objects to your config file like:

"user": { ... }
  "projects": [{
    "name": "eHealth Africa",
    "path": "/home/user/Data/TimeTracking/ehealth.csv"
  } ...

This should probably change to use datapackage.json files as opposed to CSV, but should wait for #42

@simonv3
Copy link
Contributor

simonv3 commented Jan 12, 2016

Heh, interesting, I've just been using one csv file for all my projects, which means that it's been just a matter of pressing up and command. This is better organization wise (and how I did it originally, but it was a pain to keep track of all the files). I'll test it out.

@bnvk
Copy link
Owner Author

bnvk commented Jan 17, 2016

@simonv3 i've made the cli/output.js file actually walk a user through exporting a report in a nice user friendly (from CLI) way as well as use the config.json file. I mapped this to coutput bin call for now.

My current thinking is, this command (as well as ctrack) should be moved to something like conjuror output and conjuror track while the normal conjuror command will still be accessible as a call over STDIN/OUT

@bnvk
Copy link
Owner Author

bnvk commented Jan 19, 2016

@simonv3 OK just pushed a a pretty simple (took me 30 mins) but big improvement to the CLI change. It does the following:

  • Consolidates ctrack and coutput all into just conjuror
  • Supports CLI conjuror setup
  • Supports CLI conjuror track
  • Supports CLI conjuror output
  • Added CLI conjuror view which just renders filtered data to CLI for quick checks
  • Broke the normal conjuror command that accepts --flags

Hooray, we pretty much have a working CLI app, except the following two things need to be done before closing this issue:

  • Refactor --flags to use the Commander args
  • Refactor the muliple interfaces in cli/ dir to be more efficient with included modules / values

That said, there's probably bugs with the setup / config process since we've changed so many things in recent months. And we need to make creating new projects and such also have their own commands / be more intuitive.

@simonv3
Copy link
Contributor

simonv3 commented Jan 19, 2016

Cool, I'll test it out! Thanks for doing all this work recently!

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

No branches or pull requests

2 participants