From c03632adb5e3563867fe2976ad628c3ebb7fe3bf Mon Sep 17 00:00:00 2001 From: Amjith Ramanujam Date: Fri, 3 May 2024 08:58:43 -0700 Subject: [PATCH 1/2] Check if startup commands are a list. --- litecli/liteclirc | 4 ++-- litecli/main.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/litecli/liteclirc b/litecli/liteclirc index 924b585..1184278 100644 --- a/litecli/liteclirc +++ b/litecli/liteclirc @@ -122,7 +122,7 @@ output.even-row = "" # Startup commands # litecli commands or sqlite commands to be executed on startup. -# some of them will require you to have a database attached. +# some of them will require you to have a database attached. # they will be executed in the same order as they appear in the list. [startup_commands] -#commands = ".tables", "pragma foreign_keys = ON;" \ No newline at end of file +#commands = ".tables", "pragma foreign_keys = ON;" diff --git a/litecli/main.py b/litecli/main.py index 268ede2..35638bd 100644 --- a/litecli/main.py +++ b/litecli/main.py @@ -588,7 +588,11 @@ def one_iteration(text=None): def startup_commands(): if self.startup_commands: if "commands" in self.startup_commands: - for command in self.startup_commands["commands"]: + if isinstance(self.startup_commands["commands"], str): + commands = [self.startup_commands["commands"]] + else: + commands = self.startup_commands["commands"] + for command in commands: try: res = sqlexecute.run(command) except Exception as e: From fab06ca7a9ce90e725e550eb69200789408eebb8 Mon Sep 17 00:00:00 2001 From: Amjith Ramanujam Date: Fri, 3 May 2024 09:02:30 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edee1e9..21b4121 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## Upcoming - TBD + +### Features + + +### Bug Fixes + +* Support a single item in the startup commands in the config. (bug #176) + + ## 1.10.1 - 2024-3-23 ### Bug Fixes