Skip to content

Commit

Permalink
feat(doorstop): ability to read an rc file from cwd
Browse files Browse the repository at this point in the history
Doorstop already has a setting to run custom configuration with the flag
--setings, as a second option now doorstop can read a file named
'.doorstoprc.py' to override the default settings
  • Loading branch information
lbiaggi committed Sep 4, 2024
1 parent 95b43fe commit b5a56f4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions doorstop/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
EDITOR = os.environ.get("EDITOR")


def findrc_file() -> Path | None:
cwd = Path.cwd()
doorstoprc = cwd / ".doorstoprc.py"
return doorstoprc if doorstoprc.is_file() else None


def main(args=None): # pylint: disable=R0915
"""Process command-line arguments and run the program."""
from doorstop import CLI, DESCRIPTION, VERSION
Expand Down Expand Up @@ -180,8 +186,9 @@ def main(args=None): # pylint: disable=R0915
utilities.configure_logging(args.verbose)

# Configure settings
if args.settings:
file_settings = common.import_path_as_module(Path(args.settings))
run_settings = args.settings or findrc_file()
if run_settings:
file_settings = common.import_path_as_module(Path(run_settings))
# get overridden setting list
custom_settings = (
x
Expand Down

0 comments on commit b5a56f4

Please sign in to comment.