crypti / ccoin

:part_alternation_mark: Convert and fetch the cost of over 1000 cryptocurrencies within your terminal, and save repeated queries
MIT License
23 stars 1 forks source link

Add profile support #3

Closed radiovisual closed 7 years ago

radiovisual commented 7 years ago

To save a profile --save-as:

ccoin btc jpy,usd --save-as=yen-stuff 

To load a profile -p:

ccoin -p yen-stuff

To set a default:

ccoin btc jpy,usd --set-default

To create a profile AND make it the default:

ccoin btc jpy,usd --save-as=yen-stuff --set-default

Once a default profile has been saved, no parameters are needed:

ccoin

To list your profiles -p without parameters:

ccoin -p

@brh55, @rightlag, please feel free to tweak this API, I just threw this together quickly.

brh55 commented 7 years ago

This is going to be really handy. No changes in the API, looks good 🗡

radiovisual commented 7 years ago

@brh55 , do you want to impose a default profile, or leave all profiles blank and let the user manage from nothing?

brh55 commented 7 years ago

@radiovisual By imposing do you mean the first time they initiate the bin, their --from and --to are stored in the default profile?

radiovisual commented 7 years ago

no, I was just thinking of having a default already defined. One that we think might be interesting from the more common cryptos.

radiovisual commented 7 years ago

but the more I think about it, the less I like the idea of an imposed default. So unless you are in love with the idea, let's skip it.

radiovisual commented 7 years ago

what I wouldn't mind, though, is creating a profile based on the most popular crypto pairs, like, if I were to do a profile named "top5", or "top-5" which listed off the top-five most popular cryptos along with USD,EUR

brh55 commented 7 years ago

Ahh I see, well that wouldn't be too bad, but I wouldn't stress over it. I really like that idea of predefined profiles. That would be perfect for just exploring different ones.

brh55 commented 7 years ago

What would be neat is a way to point to a script to dynamically create the symbols. Thus you could write something that fetched from an external API and would be dynamic everytime.

brh55 commented 7 years ago

I haven't done profiles in a CLI, what are the general steps to accomplishing this? I'm assuming some sort of file written to a path/directory?

radiovisual commented 7 years ago

what are the general steps to accomplishing this? I'm assuming some sort of file written to a path/directory?

Yes, that is the approach I have in mind. I am stealing ideas from NPM, and just using a profiles.json file that stores the profile data in the module directory.

What would be neat is a way to point to a script to dynamically create the symbols

Can you explain a bit more? I am not sure I follow.

That would be perfect for just exploring different ones [predefined profiles]

Ok, then we can revisit this once profile support has been added, and then discuss any predefined ideas we might have in a new thread.

radiovisual commented 7 years ago

Ok, profile support has been added. Please see the updated README to see the final API, but basically, I have made it so that you don't have to specify a flag or option when loading a profile name, so if you have a profile named stuff, then you just have to type:

$ ccoin stuff

Also, if a default profile has been supplied, then simply running:

$ ccoin

will automatically run the default profile.