c2c740972c11b784f32cbd1f45d7500dc38b3bb2
[htsworkflow.git] / scripts / retrieve_config
1 #!/usr/bin/env python
2 import sys
3 from gaworkflow.pipeline.retrieve_config import *
4 from gaworkflow.pipeline import retrieve_config
5
6 #Turn on built-in command-line parsing.
7 retrieve_config.DISABLE_CMDLINE = False
8
9 def main(args=None):
10   #Display help if no args are presented
11   if len(sys.argv) == 1:
12     sys.argv.append('-h')
13     
14   options = getCombinedOptions()
15   msg_list = ['ERROR MESSAGES:']
16   if options.output_filepath is None:
17     msg_list.append("  Output filepath argument required. -o <filepath> or --output=<filepath>")
18     
19   if options.flowcell is None:
20     msg_list.append("  Flow cell argument required. -f <flowcell> or --flowcell=<flowcell>")
21     
22   if options.url is None:
23     msg_list.append("  URL argument required (-u <url> or --url=<url>), or entry\n" \
24                     "    in /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf")
25     
26   if len(msg_list) > 1:
27     print '\n'.join(msg_list)
28     return 1
29   
30   saveConfigFile(options.flowcell, options.url, options.output_filepath)
31   return 0
32   
33 if __name__ == "__main__":
34   sys.exit(main(sys.argv[1:]))