Loading src/tools/git_pu.py +57 −5 Changes for src/tools/git_pu.py: 57 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -9,7 +9,8 @@ from argparse import ( ) from shutil import get_terminal_size from sys import exit as sys_exit from typing import List from time import sleep from typing import List, Optional # Modules libraries from questionary import ( Loading Loading @@ -37,6 +38,7 @@ def git_pu( no_verify: bool, ref: str, force: bool, confirmation: Optional[bool] = None, ) -> int: # Variables Loading Loading @@ -125,7 +127,14 @@ def git_pu( f'{Colors.RESET}', end='', ) if questionary_press_any_key_to_continue( Platform.flush() if confirmation is True and (not risky or force): print(' (Confirmed by argument)') Platform.flush() sleep(1) elif confirmation is False: return -3 elif questionary_press_any_key_to_continue( message='', style=None, ).ask() is None: Loading @@ -152,7 +161,14 @@ def git_pu( f'{Colors.RESET}', end='', ) if questionary_press_any_key_to_continue( Platform.flush() if confirmation is True and (not risky or force): print(' (Confirmed by argument)') Platform.flush() sleep(1) elif confirmation is False: return -4 elif questionary_press_any_key_to_continue( message='', style=None, ).ask() is None: Loading Loading @@ -210,7 +226,17 @@ def git_pu( f'{Colors.RESET}', end='', ) if not questionary_confirm( if confirmation is True and (not risky or force): print(' (Confirmed by argument)') Platform.flush() sleep(1) elif confirmation is False: print(' (Canceled by argument)') print(' ') Platform.flush() sleep(1) return 0 elif not questionary_confirm( message='', default=not risky, qmark='', Loading @@ -218,11 +244,13 @@ def git_pu( auto_enter=True, ).ask(): print(' ') Platform.flush() return 0 # Selector interruption except KeyboardInterrupt: print(' ') Platform.flush() return -5 # Push to remote Loading @@ -238,6 +266,7 @@ def git_pu( def main() -> None: # Variables confirmation: Optional[bool] group: _ArgumentGroup result: int Loading Loading @@ -309,6 +338,20 @@ def main() -> None: action='store_true', help='Validate result by requesting user input', ) group.add_argument( '-y', '--yes', dest='yes', action='store_true', help='Automatic yes to user inputs', ) group.add_argument( '-n', '--no', dest='no', action='store_true', help='Automatic no to user inputs', ) group.add_argument( 'remote', nargs='?', Loading Loading @@ -345,6 +388,14 @@ def main() -> None: settings=settings, ) # Prepare confirmation if options.no: confirmation = False elif options.yes: confirmation = True else: confirmation = None # Iterate over remotes for remote in Tools.git_remotes() if options.all else [ options.remote, Loading @@ -363,6 +414,7 @@ def main() -> None: no_verify=options.no_verify, ref=options.ref, tags=options.tags, confirmation=confirmation, ) # Validate result Loading @@ -374,7 +426,7 @@ def main() -> None: updates.check() # Validate result if options.validate: if options.validate and not options.yes: print( f'{Colors.YELLOW} {Tools.NAME}:' f'{Colors.GREEN if result >= 0 else Colors.RED} Press any key to continue...' Loading Loading
src/tools/git_pu.py +57 −5 Changes for src/tools/git_pu.py: 57 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -9,7 +9,8 @@ from argparse import ( ) from shutil import get_terminal_size from sys import exit as sys_exit from typing import List from time import sleep from typing import List, Optional # Modules libraries from questionary import ( Loading Loading @@ -37,6 +38,7 @@ def git_pu( no_verify: bool, ref: str, force: bool, confirmation: Optional[bool] = None, ) -> int: # Variables Loading Loading @@ -125,7 +127,14 @@ def git_pu( f'{Colors.RESET}', end='', ) if questionary_press_any_key_to_continue( Platform.flush() if confirmation is True and (not risky or force): print(' (Confirmed by argument)') Platform.flush() sleep(1) elif confirmation is False: return -3 elif questionary_press_any_key_to_continue( message='', style=None, ).ask() is None: Loading @@ -152,7 +161,14 @@ def git_pu( f'{Colors.RESET}', end='', ) if questionary_press_any_key_to_continue( Platform.flush() if confirmation is True and (not risky or force): print(' (Confirmed by argument)') Platform.flush() sleep(1) elif confirmation is False: return -4 elif questionary_press_any_key_to_continue( message='', style=None, ).ask() is None: Loading Loading @@ -210,7 +226,17 @@ def git_pu( f'{Colors.RESET}', end='', ) if not questionary_confirm( if confirmation is True and (not risky or force): print(' (Confirmed by argument)') Platform.flush() sleep(1) elif confirmation is False: print(' (Canceled by argument)') print(' ') Platform.flush() sleep(1) return 0 elif not questionary_confirm( message='', default=not risky, qmark='', Loading @@ -218,11 +244,13 @@ def git_pu( auto_enter=True, ).ask(): print(' ') Platform.flush() return 0 # Selector interruption except KeyboardInterrupt: print(' ') Platform.flush() return -5 # Push to remote Loading @@ -238,6 +266,7 @@ def git_pu( def main() -> None: # Variables confirmation: Optional[bool] group: _ArgumentGroup result: int Loading Loading @@ -309,6 +338,20 @@ def main() -> None: action='store_true', help='Validate result by requesting user input', ) group.add_argument( '-y', '--yes', dest='yes', action='store_true', help='Automatic yes to user inputs', ) group.add_argument( '-n', '--no', dest='no', action='store_true', help='Automatic no to user inputs', ) group.add_argument( 'remote', nargs='?', Loading Loading @@ -345,6 +388,14 @@ def main() -> None: settings=settings, ) # Prepare confirmation if options.no: confirmation = False elif options.yes: confirmation = True else: confirmation = None # Iterate over remotes for remote in Tools.git_remotes() if options.all else [ options.remote, Loading @@ -363,6 +414,7 @@ def main() -> None: no_verify=options.no_verify, ref=options.ref, tags=options.tags, confirmation=confirmation, ) # Validate result Loading @@ -374,7 +426,7 @@ def main() -> None: updates.check() # Validate result if options.validate: if options.validate and not options.yes: print( f'{Colors.YELLOW} {Tools.NAME}:' f'{Colors.GREEN if result >= 0 else Colors.RED} Press any key to continue...' Loading