vinitkumar / googlecl

GoogleCL rewrite in __progress__
Other
324 stars 48 forks source link

Implement command line arguments using click #276

Open vinitkumar opened 5 years ago

vinitkumar commented 5 years ago

Since, this project uses click, we will need to port all of the command line flags to the click based system. Click is amazing because it support grouping and nested grouping as well.

vinitkumar commented 5 years ago

Full list of command line flags here:

Usage: ./google [help|picasa|blogger|youtube|docs|contacts|calendar|finance] TASK [options]

This program provides command-line access to
(some) google services via their gdata APIs.
Called without a service name, it starts an interactive session.

NOTE: GoogleCL will interpret arguments as required options in the
order they appear in the descriptions below, excluding options
set in the configuration file and non-primary terms in parenthesized
OR groups. For example:

    $ google picasa get my_album .
is interpreted as "google picasa get --title=my_album --dest=.

    $ google contacts list john
is interpreted as "$ google contacts list --fields=<config file def> --title=john --delimiter=,"
(only true if you have not removed the default definition in the config file!)

    $ google docs get my_doc .
is interpreted as "$ google docs get --title=my_doc --dest=.
(folder is NOT set, since the title option is satisfied first.)

Available tasks for service picasa: 'get', 'create', 'list', 'list-albums', 'tag', 'post', 'delete'
 get: Download albums
  Requires: title AND dest Optional: owner, format, photo

 create: Create an album
  Requires: title Optional: src, date, summary, tags, access

 list: List photos
  Requires: fields AND delimiter Optional: title, query, owner, photo

 list-albums: List albums
  Requires: fields AND delimiter Optional: title, owner

 tag: Tag/caption photos
  Requires: (title OR query) AND (tags OR summary) Optional: owner, photo

 post: Post photos to an album
  Requires: title AND src Optional: tags, owner, photo, summary

 delete: Delete photos or albums
  Requires: (title OR query) Optional: photo

Available tasks for service blogger: 'post', 'tag', 'list', 'delete'
 post: Post content.
  Requires: src AND blog Optional: title, tags, access

 tag: Label posts
  Requires: blog AND title AND tags

 list: List posts in a blog
  Requires: fields AND blog AND delimiter Optional: title, owner

 delete: Delete a post.
  Requires: blog AND title

Available tasks for service youtube: 'post', 'tag', 'list', 'delete'
 post: Post a video.
  Requires: src AND category AND devkey Optional: title, summary, tags, access

 tag: Add tags to a video and/or change its category.
  Requires: title AND (tags OR category) AND devkey

 list: List videos by user.
  Requires: fields AND delimiter Optional: title, owner

 delete: Delete videos.
  Requires: title AND devkey

Available tasks for service docs: 'edit', 'delete', 'list', 'upload', 'get'
 edit: Edit a document
  Requires: title Optional: format, editor, folder

 delete: Delete documents
  Requires: title Optional: folder

 list: List documents
  Requires: fields AND delimiter Optional: title, folder

 upload: Upload a document
  Requires: src Optional: title, folder, format

 get: Download a document
  Requires: (title OR folder) AND dest Optional: format

Available tasks for service contacts: 'list', 'list-groups', 'add', 'add-groups', 'delete-groups', 'delete'
 list: List contacts
  Requires: fields AND title AND delimiter

 list-groups: List contact groups
  Requires: title

 add: Add contacts
  Requires: src

 add-groups: Add contact group(s)
  Requires: title

 delete-groups: Delete contact group(s)
  Requires: title

 delete: Delete contacts
  Requires: title

Available tasks for service calendar: 'add', 'list', 'today', 'delete'
 add: Add event to a calendar
  Requires: src Optional: cal

 list: List events on a calendar
  Requires: fields AND delimiter Optional: title, query, date, cal

 today: List events for the next 24 hours
  Requires: fields AND delimiter Optional: title, query, cal

 delete: Delete event from a calendar
  Requires: (title OR query) Optional: date, cal

Available tasks for service finance: 'list-txn', 'delete-pos', 'create-pos', 'delete-txn', 'create', 'create-txn', 'list', 'list-pos', 'delete'
 list-txn: List transactions
  Requires: title AND ticker

 delete-pos: Delete positions
  Requires: title Optional: ticker

 create-pos: Create position
  Requires: title AND ticker

 delete-txn: Delete transactions
  Requires: title AND ticker Optional: txnid

 create: Create a portfolio
  Requires: title AND currency

 create-txn: Create transaction
  Requires: title AND ticker AND ttype AND shares AND price Optional: shares, price, date, commission, currency, notes

 list: List portfolios
  Requires: none Optional: fields

 list-pos: List positions
  Requires: title Optional: fields

 delete: Delete portfolios
  Requires: title

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --access=ACCESS       Specify access/visibility level of an upload
  --blog=BLOG           Blogger only - specify a blog other than your primary.
  --cal=CAL             Calendar only - specify a calendar other than your
                        primary.
  -c CATEGORY, --category=CATEGORY
                        YouTube only - specify video categories as a comma-
                        separated list, e.g. "Film, Travel"
  --commission=COMMISSION
                        Finance only - specify commission for transaction
  --config=CONFIG       Specify location of config file.
  --currency=CURRENCY   Finance only - specify currency for portfolio
  --devtags=DEVTAGS     YouTube only - specify developer tags as a comma-
                        separated list.
  --devkey=DEVKEY       YouTube only - specify a developer key
  -d DATE, --date=DATE  Calendar only - date of the event to add/look for. Can
                        also specify a range with a comma. Picasa only - sets
                        the date of the album Finance only - transaction
                        creation date
  --debug               Enable all debugging output, including HTTP data
  --delimiter=DELIMITER
                        Specify a delimiter for the output of the list task.
  --dest=DEST           Destination. Typically, where to save data being
                        downloaded.
  --draft               Blogger only - post as a draft. Shorthand for
                        --access=draft
  --editor=EDITOR       Docs only - editor to use on a file.
  --fields=FIELDS       Fields to list with list task.
  -f FOLDER, --folder=FOLDER
                        Docs only - specify folder(s) to upload to / search
                        in.
  --force-auth          Force validation step for re-used access tokens
                        (Overrides --skip-auth).
  --format=FORMAT       Docs only - format to download documents as.
  --hostid=HOSTID       Label the machine being used.
  -n TITLE, --title=TITLE
                        Title of the item
  --no-convert          Google Apps Premier only - do not convert the file on
                        upload. (Else converts to native Google Docs format)
  --notes=NOTES         Finance only - specify notes for transaction
  -o OWNER, --owner=OWNER
                        Username or ID of the owner of the resource. For
                        example, 'picasa list-albums -o bob' to list bob's
                        albums
  --photo=PHOTO         Picasa only - specify title or name of photo(s)
  --price=PRICE         Finance only - specify price for transaction
  -q QUERY, --query=QUERY
                        Full text query string for specifying items. Searches
                        on titles, captions, and tags.
  --quiet               Print only prompts and error messages
  --reminder=REMINDER   Calendar only - specify time for added event's
                        reminder, e.g. "10m", "3h", "1d"
  --shares=SHARES       Finance only - specify amount of shares for
                        transaction
  --skip-auth           Skip validation step for re-used access tokens.
  --src=SRC             Source. Typically files to upload.
  -s SUMMARY, --summary=SUMMARY
                        Description of the upload, or file containing the
                        description.
  -t TAGS, --tags=TAGS  Tags for item, e.g. "Sunsets, Earth Day"
  --ticker=TICKER       Finance only - specify ticker
  --ttype=TTYPE         Finance only - specify transaction type, e.g. "Bye",
                        "Sell", "Buy to Cover", "Sell Short"
  --txnid=TXNID         Finance only - specify transaction id
  -u USER, --user=USER  Username to log in with for the service.
  -v, --verbose         Print all messages.
  --yes                 Answer "yes" to all prompts