From 5c4079a04d91510cf4358454de4f4e453e581a58 Mon Sep 17 00:00:00 2001 From: sinspired Date: Thu, 14 Nov 2024 04:33:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update_hosts.yml | 2 +- SetHosts.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_hosts.yml b/.github/workflows/update_hosts.yml index a2c706c..fc7d71c 100644 --- a/.github/workflows/update_hosts.yml +++ b/.github/workflows/update_hosts.yml @@ -43,7 +43,7 @@ jobs: python -V which python echo "Running script with sudo..." - sudo python SetHosts.py --verbose + sudo python SetHosts.py --no-input - name: Commit and push changes env: diff --git a/SetHosts.py b/SetHosts.py index 0f0eec5..4a7f520 100644 --- a/SetHosts.py +++ b/SetHosts.py @@ -81,6 +81,9 @@ def parse_args(): action="store_true", help="打印运行信息", ) + parser.add_argument( + "--no-input", action="store_true", help="Run without waiting for user input" + ) return parser.parse_args() @@ -1172,7 +1175,8 @@ async def main(): rprint( f"[bold]代码运行时间:[/bold] [cyan]{total_time.total_seconds():.2f} 秒[/cyan]" ) - input("\n任务执行完毕,按任意键退出!") + if not args.no_input: + input("\n任务执行完毕,按任意键退出!") if __name__ == "__main__":