Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument parsing for --calendar and remove deprecated cgi module #9

Closed
wants to merge 3 commits into from
Closed

Add argument parsing for --calendar and remove deprecated cgi module #9

wants to merge 3 commits into from

Conversation

monteship
Copy link

This commit add the argument parsing for the --calendar option and removes the deprecated cgi module. The --calendar argument is now parsed separately and removed from sys.argv before parsing the remaining arguments. This ensures that the --calendar argument is only used to set the calendar and then ignored. Additionally, the cgi module import has been replaced with urllib.parse to avoid deprecation warnings.

@monteship
Copy link
Author

This arg is added to have ability to have several waybar modules.

@chmouel
Copy link
Owner

chmouel commented Oct 24, 2024

this looks really good, thank you!

i am not sure i understand about this part:

The --calendar argument is now parsed separately and removed from sys.argv before parsing the remaining arguments. This ensures that the --calendar argument is only used to set the calendar and then ignored.

why does it need to be only set by the calendar and then ignored? what kind of issues is there if you just add it to the argument parsing? maybe i am missing something there?

@monteship
Copy link
Author

this looks really good, thank you!

i am not sure i understand about this part:

The --calendar argument is now parsed separately and removed from sys.argv before parsing the remaining arguments. This ensures that the --calendar argument is only used to set the calendar and then ignored.

why does it need to be only set by the calendar and then ignored? what kind of issues is there if you just add it to the argument parsing? maybe i am missing something there?

Yeah. My fault it was done overnight

@chmouel
Copy link
Owner

chmouel commented Oct 25, 2024

you only need to add this argument:

    parser.add_argument(
        "--calendar",
        help="Specify the calendar to use",
        default=DEFAULT_CALENDAR,
    )

and you don't need to redefine a new argparse

@monteship
Copy link
Author

monteship commented Oct 25, 2024

you only need to add this argument:

    parser.add_argument(
        "--calendar",
        help="Specify the calendar to use",
        default=DEFAULT_CALENDAR,
    )

and you don't need to redefine a new argparse

`parser.add_argument(
"--calendar",
help="Specify the calendar to use",
default=DEFAULT_CALENDAR,
)

initial_args, _ = parser.parse_known_args()

calendar = initial_args.calendar

parser.add_argument(
    "--gcalcli-cmdline",
    help="gcalcli command line",
    default=GCALCLI_CMDLINE.format(calendar=calendar),
)`
already updated

@monteship monteship closed this by deleting the head repository Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants