add helper for starting the process

pull/33/head 1.3
Raphaël Vinot 2015-04-04 19:21:57 +02:00
parent 78b17b013b
commit f464b81e4f
3 changed files with 14 additions and 9 deletions

View File

@ -7,7 +7,7 @@ import shlex
import subprocess
import time
from helpers import FileBase, KittenGroomerBase
from helpers import FileBase, KittenGroomerBase, main
LIBREOFFICE = '/usr/bin/unoconv'
GS = '/usr/bin/gs'
@ -318,6 +318,4 @@ class KittenGroomer(KittenGroomerBase):
self._print_log()
if __name__ == '__main__':
kg = KittenGroomer('/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm',
'/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm_out')
kg.processdir()
main(KittenGroomer)

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import os
from helpers import FileBase, KittenGroomerBase
from helpers import FileBase, KittenGroomerBase, main
printers = ['.STL', '.obj']
@ -65,6 +65,4 @@ class KittenGroomerPier9(KittenGroomerBase):
if __name__ == '__main__':
kg = KittenGroomerPier9('/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm',
'/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm_out')
kg.processdir()
main(KittenGroomerPier9)

View File

@ -3,7 +3,7 @@
import os
import shutil
from twiggy import quickSetup, log
import argparse
class KittenGroomerError(Exception):
def __init__(self, message):
@ -138,3 +138,12 @@ class KittenGroomerBase(object):
Main function doing the work, you have to implement it yourself.
'''
raise ImplementationRequired('You have to implement the result processdir.')
def main(kg_implementation):
parser = argparse.ArgumentParser(prog='KittenGroomer', description='Call the KittenGroomer implementation to do things on files present in the source directory to the destination directory')
parser.add_argument('-s', '--source', type=str, help='Source directory')
parser.add_argument('-d', '--destination', type=str, help='Destination directory')
args = parser.parse_args()
kg = kg_implementation(args.source, args.destination)
kg.processdir()