diff --git a/.coverage b/.coverage index d02e6dc7..429d02f8 100644 Binary files a/.coverage and b/.coverage differ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6b683ca8..015b284e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,10 @@ ## 1.13.0 [8th September 2024] +### Added + +- New `collection_browser.show_on_startup` config to control whether the collection browser is shown on startup. +- Watch for changes to loaded dotenv files and reload UI elements that depend on them when they change. + ### Changed - Upgraded all dependencies diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md index 3be2e67f..383c393d 100644 --- a/docs/guide/configuration.md +++ b/docs/guide/configuration.md @@ -118,6 +118,7 @@ The table below lists all available configuration options and their environment | `heading.show_version` (`POSTING_HEADING__SHOW_VERSION`) | `true`, `false` (Default: `true`) | Show/hide the version in the app header. | | `url_bar.show_value_preview` (`POSTING_URL_BAR__SHOW_VALUE_PREVIEW`) | `true`, `false` (Default: `true`) | Show/hide the variable value preview below the URL bar. | | `collection_browser.position` (`POSTING_COLLECTION_BROWSER__POSITION`) | `"left"`, `"right"` (Default: `"left"`) | The position of the collection browser on screen. | +| `collection_browser.show_on_startup` (`POSTING_COLLECTION_BROWSER__SHOW_ON_STARTUP`) | `true`, `false` (Default: `true`) | Show/hide the collection browser on startup. Can always be toggled using the command palette. | | `pager` (`POSTING_PAGER`) | (Default: `$PAGER`) | Command to use for paging text. | | `pager_json` (`POSTING_PAGER_JSON`) | (Default: `$PAGER`) | Command to use for paging JSON. | | `editor` (`POSTING_EDITOR`) | (Default: `$EDITOR`) | Command to use for opening files in an external editor. | diff --git a/docs/guide/index.md b/docs/guide/index.md index aef2c63a..61b1336f 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -49,7 +49,7 @@ This introduction will show you how to create a simple POST request to the [JSON A *collection* is simply a directory which may contain requests saved by Posting. -If you launch Posting without specifying a collection, any requests you create will be saved in the "default" collection. +If you launch Posting without specifying a collection, any requests you create will be saved in the `"default"` collection. This is a directory reserved by Posting on your filesystem, and unrelated to the directory you launched Posting from. This is fine for quick throwaway requests, but you'll probably want to create a new collection for each project you work on so that you can check it into version control. diff --git a/src/posting/app.py b/src/posting/app.py index c2d21891..ccefff4d 100644 --- a/src/posting/app.py +++ b/src/posting/app.py @@ -168,7 +168,11 @@ def compose(self) -> ComposeResult: yield AppHeader() yield UrlBar() with AppBody(): - yield CollectionBrowser(collection=self.collection) + collection_browser = CollectionBrowser(collection=self.collection) + collection_browser.display = ( + self.settings.collection_browser.show_on_startup + ) + yield collection_browser yield RequestEditor() yield ResponseArea() yield Footer(show_command_palette=False) @@ -677,13 +681,6 @@ def get_default_screen(self) -> MainScreen: layout=self.settings.layout, environment_files=self.environment_files, ) - if not self.collection_specified: - self.notify( - "Using the default collection directory.", - title="No collection specified", - severity="warning", - timeout=7, - ) return self.main_screen def get_css_variables(self) -> dict[str, str]: diff --git a/src/posting/config.py b/src/posting/config.py index ae0b2cf1..c889965e 100644 --- a/src/posting/config.py +++ b/src/posting/config.py @@ -89,6 +89,9 @@ class CollectionBrowserSettings(BaseModel): position: Literal["left", "right"] = Field(default="left") """The position of the collection browser on screen.""" + show_on_startup: bool = Field(default=True) + """If enabled, the collection browser will be shown on startup.""" + class Settings(BaseSettings): model_config = SettingsConfigDict(