-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve startup time, added user config
- Loading branch information
Showing
7 changed files
with
137 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
dev: | ||
textual run --dev application.main:UI | ||
poetry shell && textual run --dev application.main:UI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import yaml | ||
from pydantic import BaseModel | ||
|
||
|
||
CONFIG_PATH = "config.yaml" | ||
|
||
|
||
class Config(BaseModel): | ||
log_tail: int | ||
start_wrap: bool | ||
start_fullscreen: bool | ||
start_scroll: bool | ||
|
||
def __repr__(self) -> str: | ||
return super().__repr__(self.start_wrap) | ||
|
||
|
||
def create_default_config(): | ||
default_config = { | ||
"log_tail": 2000, | ||
"start_wrap": False, | ||
"start_fullscreen": False, | ||
"start_scroll": False, | ||
} | ||
with open(CONFIG_PATH, "w") as file: | ||
yaml.dump(default_config, file) | ||
|
||
|
||
def load_config(): | ||
if not os.path.exists(CONFIG_PATH): | ||
create_default_config() | ||
with open(CONFIG_PATH, "r") as file: | ||
config_dict = yaml.safe_load(file) | ||
return Config(**config_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
log_tail: 2000 | ||
start_fullscreen: false | ||
start_scroll: true | ||
start_wrap: false |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters