diff options
author | Matt Singleton <matt@xcolour.net> | 2017-04-16 16:59:02 -0400 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2017-04-16 16:59:02 -0400 |
commit | e690fdfa6f1eebac5a4790668ab946e82f947eaf (patch) | |
tree | 68acd6d44669042168b9bac15c9910c6fd03ab0b | |
parent | 0ac55bbafa02ad951c9f1708f1fbc7c8746d5fce (diff) |
take webroot as a command line argument
-rwxr-xr-x | main.py | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1,5 +1,8 @@ #!/usr/bin/env python3 +import argparse +import os + from unbiasedObjects import * from unbiasedFunctions import * from parser import * @@ -7,13 +10,17 @@ import time def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-w', '--webroot', default='/var/www/ubiased', help='location to write the output html') + args = parser.parse_args() + while True: print('-----------------------') - run() + run(args.webroot) print('-----------------------') time.sleep(600) -def run(): +def run(webroot): sourceList=[] ''' @@ -25,6 +32,8 @@ def run(): ''' + print('running with webroot="{}"'.format(webroot)) + ### These values have to be the second half of the function name ### E.g. Guardian calls buildGuardian(), etc. @@ -54,7 +63,7 @@ def run(): outputHTML=buildOutput(newsSourceArr) #print the output file HTML - printOutputHTML(outputHTML, '/var/www/html/index.html') + printOutputHTML(outputHTML, os.path.join(webroot, 'index.html')) if __name__=="__main__": |