Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gcalcli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
from argparse import ArgumentTypeError
from collections import namedtuple

import shopen

from . import config, env, utils
from .argparsers import get_argument_parser, handle_unparsed
from .exceptions import GcalcliError
Expand Down Expand Up @@ -347,7 +349,7 @@ def main():
config_filepath.parent.mkdir(parents=True, exist_ok=True)
with open(config_filepath, 'w') as f:
f.write(EMPTY_CONFIG_TOML)
utils.launch_editor(config_filepath)
shopen.open(config_filepath, 'edit')
Comment on lines 349 to +352
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new config edit path now depends on calling shopen.open(...), but there doesn’t appear to be any automated test covering this behavior (the existing CLI bats tests cover other commands but not config edit). Please add a test that exercises gcalcli config edit while stubbing/monkeypatching shopen.open so the test can assert it’s invoked with edit without launching a real editor, and that the config file is created when missing.

Copilot uses AI. Check for mistakes.

elif parsed_args.command == 'util':
if parsed_args.subcommand == 'config-schema':
Expand Down
22 changes: 0 additions & 22 deletions gcalcli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
from collections import OrderedDict
import json
import locale
import os
import pathlib
import pickle
import re
import subprocess
import time
from datetime import datetime, timedelta
from typing import Any, Tuple
Expand Down Expand Up @@ -207,26 +205,6 @@ def localize_datetime(dt):
return dt.astimezone(tzlocal())


def launch_editor(path: str | os.PathLike):
if hasattr(os, 'startfile'):
os.startfile(path, 'edit')
return
for editor in (
'editor',
os.environ.get('EDITOR', None),
'xdg-open',
'open',
):
if not editor:
continue
try:
subprocess.call((editor, path))
return
except OSError:
pass
raise OSError(f'No editor/launcher detected on your system to edit {path}')


def shorten_path(path: pathlib.Path) -> pathlib.Path:
"""Try to shorten path using special characters like ~.

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"platformdirs",
"pydantic",
"python-dateutil",
"shopen >= 0.2.2",
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependency spec formatting is inconsistent with the rest of this file: other requirements are written without spaces around the version operator (e.g., google-api-python-client>=1.4). Consider changing "shopen >= 0.2.2" to "shopen>=0.2.2" for consistency and to avoid potential issues with tools that do strict parsing.

Suggested change
"shopen >= 0.2.2",
"shopen>=0.2.2",

Copilot uses AI. Check for mistakes.
"tomli; python_version < '3.11'",
"truststore",
]
Expand Down