feat: Add setup function

This commit is contained in:
2026-04-15 15:59:36 +02:00
parent ead9e3a3f7
commit f5386d0e98
3 changed files with 20 additions and 5 deletions
+5 -5
View File
@@ -5,7 +5,7 @@ import commands.config as config
import commands.init as init
import commands.pull as pull
import commands.push as push
import commands.prepare as setup
if __name__ == "__main__":
args, ap = cliargs.add_cli_args()
@@ -15,8 +15,7 @@ if __name__ == "__main__":
print("\nSpecify a subcommand, '-h' or '-v'")
exit(64)
print(
"""
print("""
_
( )
_ _ _ __ ___| |__ ___ ___ __ _ __
@@ -25,8 +24,7 @@ if __name__ == "__main__":
\\__ _)_) \\____)_) (_)_) (_) (_)\\__ |_)
( )_) |
\\___/
"""
)
""")
try:
if args.cmd == "commit":
@@ -35,6 +33,8 @@ if __name__ == "__main__":
config.config()
elif args.cmd == "init":
init.init(args.force)
elif args.cmd == "setup":
setup.setup()
elif args.cmd == "pull":
pull.pull(args.rebase, args.apply)
elif args.cmd == "push":
+2
View File
@@ -34,6 +34,8 @@ def add_cli_args():
sp.add_parser("config", help="prints information about your config")
sp.add_parser("setup", help="Do initial setup, like installing required tools")
init = sp.add_parser("init", help="initialize a new archmgr repository")
init.add_argument(
"--force",
+13
View File
@@ -0,0 +1,13 @@
import subprocess
from commands.util import pacman
def setup():
print("==> Installing required packages")
if not pacman.install_package_list(["git"]):
print("Git installation failed")
return
subprocess.run(["git", "clone", "https://aur.archlinux.org/yay.git"], cwd="/tmp")
subprocess.run(["makepkg", "-si"], cwd="/tmp/yay")
print("==> Installation completed")