feat: Add setup function
This commit is contained in:
+5
-5
@@ -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":
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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")
|
||||
Reference in New Issue
Block a user