-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrstudio
More file actions
executable file
·25 lines (18 loc) · 753 Bytes
/
rstudio
File metadata and controls
executable file
·25 lines (18 loc) · 753 Bytes
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
#!/usr/bin/env python
import sys
from rstudio_server_manager import commands, parsers
def main() -> None:
"""Main function that starts the manager."""
# Parse command line args and show help if none are given
parser = parsers.get_main_parser()
args = parser.parse_args([sys.argv[1]] if sys.argv[1:] else ["--help"])
# Show the help if an invalid command is given
if args.command is None or not hasattr(commands, args.command):
print(f"\nunrecognized command: {args.command}\n")
parser.print_help()
exit(1)
# Get the function corresponding to the command and run it with the arguments
command = getattr(commands, args.command)
command(sys.argv[2:])
if __name__ == "__main__":
main()