Skip to content

Commit 658e35a

Browse files
committed
Refactor script list
1 parent bde544c commit 658e35a

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

archinstall/main.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import textwrap
77
import time
88
import traceback
9+
from pathlib import Path
910

1011
from archinstall.lib.args import arch_config_handler
1112
from archinstall.lib.disk.utils import disk_layouts
@@ -62,6 +63,16 @@ def _fetch_arch_db() -> bool:
6263
return True
6364

6465

66+
def _list_scripts() -> str:
67+
lines = ['The following are viable --script options:']
68+
69+
for file in (Path(__file__).parent / 'scripts').glob('*.py'):
70+
if file.stem != '__init__':
71+
lines.append(f' {file.stem}')
72+
73+
return '\n'.join(lines)
74+
75+
6576
def run() -> int:
6677
"""
6778
This can either be run as the compiled and installed application: python setup.py install
@@ -72,6 +83,10 @@ def run() -> int:
7283
arch_config_handler.print_help()
7384
return 0
7485

86+
if arch_config_handler.get_script() == 'list':
87+
print(_list_scripts())
88+
return 0
89+
7590
if os.getuid() != 0:
7691
print(tr('Archinstall requires root privileges to run. See --help for more.'))
7792
return 1

archinstall/scripts/list.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)