From 1a76fca88178613e6faac558803199440d8d0f1a Mon Sep 17 00:00:00 2001
From: Yohan Jarosz <yohanjarosz@yahoo.fr>
Date: Tue, 21 Jul 2015 16:02:59 +0200
Subject: [PATCH] add --ask param

---
 IMP | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/IMP b/IMP
index d356da8..4a3d6ea 100755
--- a/IMP
+++ b/IMP
@@ -16,7 +16,7 @@ __doc__ = """Integrated Metaomic Pipeline.
 (____)(_/\/\_)(__)
 
 Usage:
-  IMP [-m MG1 -m MG2] [-t MT1 -t MT2] -o OUTPUT [--enter] [--norm] [-n CONTAINER] [-d DBPATH] [-e ENV] ... [COMMANDS ...]
+  IMP [-m MG1 -m MG2] [-t MT1 -t MT2] -o OUTPUT [--enter] [--norm] [--ask] [-n CONTAINER] [-d DBPATH] [-e ENV] ... [COMMANDS ...]
   IMP --init [-d DBPATH]
   IMP (-h | --help)
   IMP --version
@@ -26,6 +26,7 @@ Options:
   --enter           Enter the container
   --init            Initialize IMP databases (Take a while)
   --norm            Don't delete the container after use. Useful for debugging.
+  --ask             Ask to create directory if it desn't exist.
   -h --help         Show this help and exit
   -m MG             Path to the metagenomics paired files (must be 2 files).
   -t MT             Path to the metatranscriptomic paired files (2 files).
@@ -97,10 +98,9 @@ def run(args):
 
     output = Path(args['-o']).abspath()
     if not output.exists():
-        if yes_or_no("Output '%s' doesn't exist. Create ?" % output):
-            output.makedirs()
-        else:
+        if args['--ask'] and not yes_or_no("Output '%s' doesn't exist. Create ?" % output):
             exit(0)
+        output.makedirs()
     container_name = args['-n'] is not None and args['-n'] or 'imp:latest'
     db_path = Path(args['-d']).abspath()
     # configure IMP mount point to the docker container
-- 
GitLab