This repository was archived by the owner on Sep 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change 11"""Replace active variables with another set"""
2- import sys
2+ from platform import system
3+ import argparse
34import os
45
5- def replace_env ( ):
6+ def replace_set ( set_file ):
67 """Replace Variable File"""
7- print ("Enter Set to Import: " , end = '' )
8- new_env = input ()
9-
10- if "windows" in sys .platform :
11- os .system ("copy variable_sets\\ " + str (new_env ) + ".py user_variables.py" )
8+ # Options are Darwin, Linux, Java and Windows. Java not supported
9+ if "Windows" in system ():
10+ os .system ("copy variable_sets\\ " + str (set_file ) + ".py user_variables.py" )
1211 else :
13- os .system ("cp variable_sets/" + str (new_env ) + ".py user_variables.py" )
12+ os .system ("cp variable_sets/" + str (set_file ) + ".py user_variables.py" )
13+
14+ def get_variable_set_file (variable_set_arg ):
15+ """Checks if the set file was provided via arg else prompt"""
16+ if variable_set_arg :
17+ return variable_set_arg
18+ return input ("Enter Set to Import: " )
1419
15- replace_env ()
20+ if __name__ == '__main__' :
21+ parser = argparse .ArgumentParser ()
22+ parser .add_argument ('--set-file' , '-s' )
23+ args = parser .parse_args ()
24+ set_file = get_variable_set_file (args .set_file )
25+ replace_set (set_file )
You can’t perform that action at this time.
0 commit comments