2021-07-02 09:50:21 +02:00
|
|
|
import sys
|
|
|
|
|
|
|
|
class Multi():
|
|
|
|
|
|
|
|
def __init__(self, patterns, files):
|
|
|
|
self.patterns = patterns
|
|
|
|
self.files = files
|
|
|
|
|
|
|
|
def print_matches(self, patterns, files):
|
2021-07-02 10:29:17 +02:00
|
|
|
error = "Invalid input.\nExample: shellnotes -m pattern1,pattern2,pattern3 file1,file2,file3"
|
|
|
|
for pattern in patterns:
|
|
|
|
if pattern == "": return error
|
|
|
|
print(pattern, end=", ")
|
2021-07-02 09:50:21 +02:00
|
|
|
print()
|
2021-07-02 10:29:17 +02:00
|
|
|
for file in files:
|
|
|
|
if file == "": return error
|
|
|
|
print(file, end=", ")
|
2021-07-02 09:50:21 +02:00
|
|
|
|
|
|
|
try:
|
|
|
|
newMulti = Multi(sys.argv[1].split(','), sys.argv[2].split(','))
|
|
|
|
newMulti.print_matches(sys.argv[1].split(','), sys.argv[2].split(','))
|
|
|
|
except IndexError:
|
|
|
|
patterns = input("Enter patterns, separated by a comma: ")
|
|
|
|
files = input("Enter files, separated by a comma: ")
|
2021-07-02 10:29:17 +02:00
|
|
|
newMulti = Multi(patterns.split(','), files.split(','))
|
2021-07-02 09:50:21 +02:00
|
|
|
newMulti.print_matches(patterns.split(','), files.split(','))
|
|
|
|
|