This repository was archived by the owner on Sep 22, 2024. It is now read-only.
File tree 1 file changed +19
-9
lines changed
1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change 1
1
"""Replace active variables with another set"""
2
- import sys
2
+ from platform import system
3
+ import argparse
3
4
import os
4
5
5
- def replace_env ( ):
6
+ def replace_set ( set_file ):
6
7
"""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" )
12
11
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: " )
14
19
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