only global options work in .gcalclirc after upgrade to 4.0.x (argparse)
After a system upgrade to Ubuntu 18.044 I get error messages for my .gcalclirc file.
This is the content of the file:
--military
--allday
--duration=1
[email protected]
--monday
--width=13
--monday
If I try removing this file and use only command line options I don't manage to specify a calendar for add task:
gcalcli add --when=tomorrow --title="A task" --duration=1 --allday --calendar="[email protected]"
The following options are either no longer valid globally or just plain invalid: [email protected] Must specify a single calendar
Order of options matters now:
gcalcli --calendar="[email protected]" add --when=tomorrow ...
Pretty sure that'll do it (but don't quote me on it ;-) )
That worked properly for the command line, but, how do I set my .gcalcirc file for the mentioned options?
thanx
Personally I have created aliases/functions for the different gcalcli commands in my bashrc. If you use bash variables to store the options and aliases/functions, you don't really have a need for a .gcalclirc in the first place.
Hi. I'm having the same problems. Are bash aliases the only currently available workaround for this? Thanks guys.
@davidgenesiscruz
Can you provide specific repro instructions alongside which version of gcalcli you're using. I think there are current issues regarding the parsing of .gcalclirc, but I don't yet have a full account of exactly what is broken and what the message from gcalcli is.
@jcrowgey
The error occur with any of the following gcalcli commands:
agenda
list
calw
calm
This is the error message displayed:
The following options are either no longer valid globally or just plain invalid:
--detail_location
--nodeclined
--monday
--military
-d
Here are the contents of my .gcalclirc (calendar names have been removed to avoid personal embarrassment lol):
--calendar=***#magenta
--calendar=***#blue
--calendar=***#cyan
--calendar=***#yellow
--calendar=***#red
--calendar=***#green
--calendar=***#cyan
--detail_location
--nodeclined
--monday
--military
-d
So, here's the high-level issue. Since we moved to argparse in the 4.0.x series (including the alpha builds, which you appear to be using), the order of options matters, as @tresni says above. The deal is that some options, like --calendar are global, applying to any gcalcli command while others are only applicable for particular commands. So, you need to follow this syntax:
$ gcalcli [GLOBAL OPTS] command [COMMAND OPTS]
We implemented a little argparse trick that is robust to some mistakes, but not all of them.
As far as I can tell, the old .gcalclirc parsing method hasn't been updated to work with any command specific options. The roadmap on this is going to be discussed in #416. But probably we'll have something which supports subcommand options via configuration sections.
To work this out for yourself, read the --help message closely. If you don't mind doing a test, I'd love it if you could confirm that your .gcalclirc works if you only specify global options in it.
Hi, I have the same problem. My gcalclirc does not work. Options that I try to implement are: --monday --military
I don't know if I understand it correctly – is gcalclirc not compatible with mentioned above variables? Or is there a new syntax that works with them?
I use gcalcli v4.0.0a3.
For now, only global options are available in .gcalclirc. We hope to fix this soon. I'll update the title of this issue and add the bug tag to try to make the current state of affairs more clear. One current workaround is to use shell aliases to invoke the command options you want.
Sorry it took me so long to get back.
To work this out for yourself, read the --help message closely. If you don't mind doing a test, I'd love it if you could confirm that your .gcalclirc works if you only specify global options in it.
I have confirmed that removing command specific options from .gcalclirc prevents the error.
I'll use the alias workaround for now. Thanks!