Created
November 1, 2020 09:46
-
-
Save cosminpopescu14/804e36c9c4ffd2220b99e9abc9df7f95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a sample Python script. | |
# Press Shift+F10 to execute it or replace it with your code. | |
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. | |
import os | |
import argparse | |
def get_args(): | |
# Create the parser | |
my_parser = argparse.ArgumentParser(description='List the content of a folder') | |
# Add the arguments | |
my_parser.add_argument("path", help='View current path') | |
my_parser.add_argument("--change", help="Chage java home path") | |
args = my_parser.parse_args() | |
return args | |
def print_path(): | |
paths = ["JAVA_HOME"] | |
for item, value in os.environ.items(): | |
if item in paths: | |
print('{}: {}'.format(item, value)) | |
def change_java_home_path(): | |
print("change_java_home_path") | |
def main() -> None: | |
args = get_args() | |
print(args.change) | |
if args.path == "path": | |
print_path() | |
if args.change != '': | |
change_java_home_path() | |
# Press the green button in the gutter to run the script. | |
if __name__ == '__main__': | |
main() | |
# See PyCharm help at https://www.jetbrains.com/help/pycharm/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not done yet