Skip to content

Commit

Permalink
simplify_branches renamed to collapse_paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jasursadikov committed Sep 12, 2024
1 parent 76685d7 commit 96bc3f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@ def _print_process_header(path: str, command: str, failed: bool, code: int):

@staticmethod
def _get_formatted_path(path: str) -> str:
simplify_branches = utils.settings.config['mud'].getboolean('simplify_branches')
collapse_paths = utils.settings.config['mud'].getboolean('collapse_paths')
if os.path.isabs(path):
home = os.path.expanduser('~')
if path.startswith(home):
path = path.replace(home, '~', 1)
if path.startswith('/'):
path = path[1:]
parts = path.split('/')
return DIM + WHITE + ('/'.join([p[0] for p in parts[:-1]] + [RESET + DIM + parts[-1]]) if simplify_branches else ('/'.join(parts[:-1])) + f'/{RESET}{DIM}' + parts[-1] + RESET)
return DIM + WHITE + ('/'.join([p[0] for p in parts[:-1]] + [RESET + DIM + parts[-1]]) if collapse_paths else ('/'.join(parts[:-1])) + f'/{RESET}{DIM}' + parts[-1] + RESET)

return f'{DIM}{path}{RESET}'

Expand Down Expand Up @@ -346,7 +346,7 @@ def _get_formatted_branches(branches: List[str], current_branch: str) -> str:
if len(branches) == 0:
return ''

simplify_branches = utils.settings.config['mud'].getboolean('simplify_branches')
collapse_paths = utils.settings.config['mud'].getboolean('collapse_paths')
output = ''

for branch in branches:
Expand All @@ -367,7 +367,7 @@ def _get_formatted_branches(branches: List[str], current_branch: str) -> str:
parts = branch.split('/')
end_dim = '' if is_origin else END_DIM
branch = '/'.join([p[0] for p in parts[:-1]] + [end_dim + (
parts[-1][:10] + '..' if len(parts[-1]) > 10 else parts[-1])]) if simplify_branches else '/'.join(
parts[-1][:10] + '..' if len(parts[-1]) > 10 else parts[-1])]) if collapse_paths else '/'.join(
[p for p in parts[:-1]] + [end_dim + (parts[-1][:10] + '..' if len(parts[-1]) > 10 else parts[-1])])
branch = f'{DIM}{branch}'
color = Runner._get_branch_color(parts[0])
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def configure():
try:
settings.config['mud']['run_table'] = str(ask('Do you want to see command execution progress in table view? This will limit output content.'))
settings.config['mud']['run_async'] = str(ask('Do you want to run commands simultaneously for multiple repositories?'))
settings.config['mud']['simplify_branches'] = str(ask(f'Do you want to simplify branches? (ex. {BOLD}feature/name{RESET} -> {BOLD}f/name{RESET}'))
settings.config['mud']['nerd_fonts'] = str(ask(f'Do you want to use {BOLD}nerd-fonts{RESET}?'))
settings.config['mud']['collapse_paths'] = str(ask(f'Do you want to collapse paths, such as directory paths and branches? (ex. {BOLD}feature/name{RESET} -> {BOLD}f/name{RESET}'))
settings.config['mud']['ask_updates'] = str(ask(f'Do you want to get information about latest updates?'))
except KeyboardInterrupt:
return
Expand Down

0 comments on commit 96bc3f5

Please sign in to comment.