insanum / sncli

Simplenote CLI
MIT License
397 stars 35 forks source link

Basic tag command line API #46

Closed ashiklom closed 7 years ago

ashiklom commented 7 years ago

This implements the syntax in #45. The following syntax should work (and works in my local tests):

sncli -k <key> tag get   # Retrieve tags

sncli -k <key> tag set "tag1,tag2"   # Sets tags to "tag1,tag2"

sncli -k <key> tag add "tag3"    # Sets tags to "tag1,tag2,tag3"
## Repeating above command will have no effect -- tags are only added if tag doesn't exist

sncli -k <key> tag rm "tag1"   # Sets tags to "tag2,tag3"
## Repeating above command again will have no effect -- tags are only removed if present
ashiklom commented 7 years ago

OK, I think I got everything. I made it so sncli -k <key> tag prints the usage, so that all of the Tag API commands have a consistent tag COMMAND syntax. But it's easy to change the behavior if you prefer.

As a side thought, at some point in the future, it could be fun to revise this to use a condensed, bash-like syntax like this...

# Add tag1, remove tag4
sncli -k <key> tag "+tag1,-tag4" 

...but I'm happy with the current system for now.

samuelallan72 commented 7 years ago

Nice! :)

Thanks @ashiklom !