Comments (4)
I like this idea... make it so. :-)
from gcalcli.
Look into using the gflags module which has the ability to transparently pass arguments down. The google-api module uses this to pass flags from main down to the oauth2 module.
from gcalcli.
@insanum Working with the gflag module isn't too bad. It's automatic output is a little ugly (and makes the help output a million miles long) but usable.
https://github.com/insanum/gcalcli/compare/gflags
Caveats
- Config files are now flag files, this makes old files non-compatible. Options are to either change the options file name for gcalcli v3 releases or to just let people know that if they don't fix their config files gcalcli will simply fail to run (normally with an error like
"[gcalcli]" is not a valid command
- gflags is not config file friendly at all. I am currently injecting a
--flagsfile=~/.gcalclirc
flag if the file exists. This is bad as it doesn't give the user any way to choose not to include this file. That said, the fact that we don't allow people to override where we are storing oauth/cache/etc means my case for using different config files is mute (different config files for different accounts.) Might be better to allow people to specify a folder where we will look for everything. This would make loading the.gcalclirc
file interesting (initial thought is we'd end up processing all flags twice if a config folder is specified, second time ignoring~/.gcalclirc
and only sourcing from the folder if it's there), but might be a better experience overall - Still need to re-add most of the flag documentation, I just put placeholder help text for now.
https://github.com/insanum/gcalcli/compare/gflags
Upsides
- You can use multiple and recursive
--flagsfile
which is cool but really not useful until the above is solved. - Reduced a lot of code, basically cut the line count of the touched lines in half! (If you ignore documentation lines we still reduced about 1/3 of the touched code.)
add
and other commands are more natural now as you can do the--title
and other flags on either side of the command. Also, added a--[no]prompt
so you can only specify exactly the pieces you want and not get prompted for stuff you left out (of course if you leave out something required, it's going to fail...)
Parting Notes
Tried to keep everything reverse-compatible for now.
Due to the caveats, I didn't merge with master yet. Let me know what you think.
We should clean up some of the flags:
--no-cache
automatically has a--nono-cache
flag which is a little dumb.- Any flag with a "-" in it has to be accessed using
FLAGS.get()
since Python doesn't allow hyphens in attributes. Most places either compound/camelcase (even though case is actually ignored) or underscores. - Any flag starting with a number has to be access using
FLAGS.get()
- Flags like
--nc
,--nl
,--mon
,--descr
,--cal
are nondescript and likely to lead to confusion. e.g. Using--description
would actually still allow for--descr
to work while being more descriptive for new users. - Color flags are ordered differently then detail flags (
--detail-X
vs--X-color
) cal
can probably be removed from most of the color flags (it's implied by the flag names since "owner", "reader", etc have no other meaning for us.)
That all said, it's 2AM, I'll dig more into this tomorrow (hopefully)
from gcalcli.
I started on a branch that implements most of the Parting Notes section.
from gcalcli.
Related Issues (20)
- Google Calendar
- Imports are disorganized
- Hourly authentication "The authentication flow has completed." HOT 1
- Use of summaryOverride HOT 1
- README.md discrepancy HOT 1
- Importing a .vcs with no events crashes gcalcli
- Formatting and first day of week
- Add option to combine default reminders with custom reminders
- --lineart unicode TypeError: can't concat str to bytes HOT 1
- App 'gcalcli' is blocked - The out-of-band (OOB) flow has been blocked HOT 8
- DeprecationWarning HOT 2
- Editing based on unique identifiers?
- Editing an recurring event seems to copy it instead of editing the selected "event instance"
- List Availability
- Access blocked: Authorization Error HOT 1
- HELP: What do I specify? (Documention missing bug) HOT 1
- HELP!!! GCalCli stopped working! I can only list calendars, and cannot do anything else HOT 12
- Out-Of-Band (OOB) flow HOT 1
- FEATURE REQUEST: Hooks into `eventTypes` (e.g. "Out of Office" or "Focus Time")
- "Something went wrong" google error when setting up oauth 2. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gcalcli.