Skip to content

Commit

Permalink
Fallback setting values are added
Browse files Browse the repository at this point in the history
  • Loading branch information
jasursadikov committed Sep 16, 2024
1 parent d7f4d23 commit 2b519a3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ jobs:
git commit -m "Initial commit"
cd ..
done
- name: Set up and Initialize
- name: Initialize
run: |
echo -e "[mud]\nrun_async = False\nrun_table = True\nnerd_fonts = False" > ~/.mudsettings
./mud.sh init
- name: Test remove by path
run: |
Expand Down
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def remove(self, args) -> None:
# Filter out repositories if user provided filters
def _filter_with_arguments(self) -> None:
self.repos = self.config.data
self.table = utils.settings.config['mud'].getboolean('run_table')
self.run_async = utils.settings.config['mud'].getboolean('run_async')
self.table = utils.settings.config['mud'].getboolean('run_table', fallback=True)
self.run_async = utils.settings.config['mud'].getboolean('run_async', fallback=True)

for path, labels in self.config.filter_label('ignore', self.config.data).items():
del self.repos[path]
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if __name__ == '__main__':
try:
utils.settings = settings.Settings(utils.SETTINGS_FILE_NAME)
if utils.settings.config['mud'].getboolean('ask_updates') and utils.update():
if utils.settings.config['mud'].getboolean('ask_updates', fallback=True) and utils.update():
sys.exit()
app = App()
app.run()
Expand Down
2 changes: 1 addition & 1 deletion runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _print_process_header(path: str, command: str, failed: bool, code: int) -> N

@staticmethod
def _get_formatted_path(path: str, color: str = None) -> str:
collapse_paths = utils.settings.config['mud'].getboolean('collapse_paths')
collapse_paths = utils.settings.config['mud'].getboolean('collapse_paths', fallback=False)

if color is None:
color = WHITE
Expand Down
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def glyphs(key: str) -> str:
return GLYPHS[key][0 if settings.config['mud'].getboolean('nerd_fonts') else 1]
return GLYPHS[key][0 if settings.config['mud'].getboolean('nerd_fonts', fallback=False) else 1]


def version() -> None:
Expand Down Expand Up @@ -129,7 +129,7 @@ def table_to_str(table: PrettyTable) -> str:
def get_table() -> PrettyTable:
def set_style(item: str) -> str:
return f'{DIM}{item}{RESET}'
table = PrettyTable(border=settings.config['mud'].getboolean('show_borders'), header=False, style=PLAIN_COLUMNS, align='l')
table = PrettyTable(border=settings.config['mud'].getboolean('show_borders', fallback=False), header=False, style=PLAIN_COLUMNS, align='l')

table.horizontal_char = set_style('─')
table.vertical_char = set_style('│')
Expand Down

0 comments on commit 2b519a3

Please sign in to comment.