-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.nu
More file actions
executable file
·116 lines (107 loc) · 3.34 KB
/
main.nu
File metadata and controls
executable file
·116 lines (107 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env nu
# Load utility modules
source lib/utils.nu
source lib/ui.nu
# Main help message
def help_message [] {
print "Thothmaster CLI - Workstation Management Tool"
print ""
print "Usage:"
print " thothmaster <command> [options]"
print ""
print "Available commands:"
print " install - Install or update tools and software"
print " config - Configure system settings"
print " version - Show version information"
print ""
print "Options:"
print " --help, -h - Show this help message"
print ""
print "For help with a specific command, run:"
print " thothmaster <command> --help"
}
# Install help message
def install_help_message [] {
print "Thothmaster CLI - Install Command"
print ""
print "Usage:"
print " thothmaster install <target> [options]"
print ""
print "Available targets:"
print " sam - Install AWS SAM CLI"
print " docker - Install Docker"
print " aws-cli - Install AWS CLI"
print " node - Install Node.js"
print " terragrunt - Install Terragrunt (--version/-v to specify version, defaults to latest)"
print " amazon-q - Install Amazon Q for command line"
print " all - Install all tools"
print ""
print "Options:"
print " --help, -h - Show this help message"
print " --version, -v <version> - Specify version for tools that support it"
}
# Handle install subcommand
def handle_install [
target: string
] {
# Source the install commands only when needed
source commands/install/sam.nu
source commands/install/docker.nu
#source commands/install/aws_cli.nu
#source commands/install/node.nu
source commands/install/terragrunt.nu
source commands/install/amazon_q.nu
source commands/install/all.nu
match $target {
"sam" => { install-sam }
"docker" => { install-docker }
"aws-cli" => { install-aws-cli }
"node" => { install-node }
"terragrunt" => { install-terragrunt }
"amazon-q" => { install-amazon-q }
"all" => { install-all }
_ => {
print $"Unknown install target: ($target)"
install_help_message
}
}
}
# Example of another top-level command handler
def handle_config [] {
print "Config command not implemented yet"
}
# Show version information
def show_version [] {
print "Thothmaster CLI v1.0.0"
}
# Define the main command
export def main [
command?: string, # The command to run
target?: string, # The target for the command
--help (-h), # Show help
--version (-v): string # Version parameter for tools that support it
] {
if $help {
help_message
return
}
match $command {
"install" => {
if ($target | is-empty) {
install_help_message
} else {
# For terragrunt with version flag
if $target == "terragrunt" and (not ($version | is-empty)) {
source commands/install/terragrunt.nu
install-terragrunt --version $version
} else {
# For all other cases
handle_install $target
}
}
}
"config" => { handle_config }
"version" => { show_version }
_ => { help_message }
}
}