Added documentation, and help screen
This commit is contained in:
@ -6,26 +6,54 @@ Description: A Caesar Cipher coding challenge given by the Crunix Club"
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
help_text = """
|
||||||
|
NAME
|
||||||
|
wcc - Willow Caesar Cipher
|
||||||
|
SYNOPSIS
|
||||||
|
wcc -k [Cyper Key (Int)] [ENCRYPTION FLAG] [STRING]
|
||||||
|
DESCRIPTION
|
||||||
|
Encrypt or Decrypt a string using a Caesar Cipher (Warning: Does not change special characters)
|
||||||
|
-E
|
||||||
|
Encrypts String
|
||||||
|
-D
|
||||||
|
Decrypts String
|
||||||
|
-h
|
||||||
|
Prints Help Screen
|
||||||
|
AUTHOR
|
||||||
|
Written by Willow Behar.
|
||||||
|
LICENSING
|
||||||
|
GPLv3
|
||||||
|
"""
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#Get Key
|
#Get Key
|
||||||
if "-k" in sys.argv:
|
if "-k" in sys.argv:
|
||||||
|
#Find key flag location
|
||||||
key_flag_location = sys.argv.index("-k")
|
key_flag_location = sys.argv.index("-k")
|
||||||
|
#Get Key Integer
|
||||||
key = int(sys.argv[key_flag_location + 1])
|
key = int(sys.argv[key_flag_location + 1])
|
||||||
if "-E" in sys.argv:
|
else:
|
||||||
#Get String
|
print("Missing Key")
|
||||||
|
print(help_text)
|
||||||
|
if "-h" in sys.argv:
|
||||||
|
#Help
|
||||||
|
print(help_text)
|
||||||
|
elif "-E" in sys.argv:
|
||||||
|
#Get Encrypt Flag Location
|
||||||
encrypt_flag_location = sys.argv.index("-E")
|
encrypt_flag_location = sys.argv.index("-E")
|
||||||
|
#Get String to encrypt
|
||||||
encrypt_string = str(sys.argv[encrypt_flag_location + 1])
|
encrypt_string = str(sys.argv[encrypt_flag_location + 1])
|
||||||
#Encrypt
|
#Encrypt
|
||||||
print(Encrypt(key, encrypt_string))
|
print(Encrypt(key, encrypt_string))
|
||||||
if "-D" in sys.argv:
|
elif "-D" in sys.argv:
|
||||||
#Get String
|
#Get Decrypt flag location
|
||||||
decrypt_flag_location = sys.argv.index("-D")
|
decrypt_flag_location = sys.argv.index("-D")
|
||||||
|
#Get String
|
||||||
decrypt_string = sys.argv[decrypt_flag_location + 1]
|
decrypt_string = sys.argv[decrypt_flag_location + 1]
|
||||||
#Decrypt
|
#Decrypt
|
||||||
print(Decrypt(key, decrypt_string))
|
print(Decrypt(key, decrypt_string))
|
||||||
if "-h" in sys.argv:
|
else:
|
||||||
#Help
|
print(help_text)
|
||||||
print("Help")
|
|
||||||
|
|
||||||
def Encrypt(key, phrase):
|
def Encrypt(key, phrase):
|
||||||
new_string = ""
|
new_string = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user