gcalcli icon indicating copy to clipboard operation
gcalcli copied to clipboard

only global options work in .gcalclirc after upgrade to 4.0.x (argparse)

Open nzurita opened this issue 7 years ago • 10 comments

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

nzurita avatar Sep 27 '18 16:09 nzurita

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 ;-) )

tresni avatar Sep 27 '18 17:09 tresni

That worked properly for the command line, but, how do I set my .gcalcirc file for the mentioned options?

thanx

nzurita avatar Sep 27 '18 18:09 nzurita

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.

NicolasWebDev avatar Nov 24 '18 22:11 NicolasWebDev

Hi. I'm having the same problems. Are bash aliases the only currently available workaround for this? Thanks guys.

deeeeekun avatar Mar 01 '19 11:03 deeeeekun

@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 avatar Mar 04 '19 03:03 jcrowgey

@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

deeeeekun avatar Mar 04 '19 04:03 deeeeekun

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.

jcrowgey avatar Mar 04 '19 16:03 jcrowgey

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.

IjonFryderyk avatar Mar 12 '19 00:03 IjonFryderyk

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.

jcrowgey avatar Mar 12 '19 20:03 jcrowgey

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!

deeeeekun avatar Mar 16 '19 02:03 deeeeekun