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