Searches for /etc/fluentsrc and ~/.fluents configuration files. Adds the
home configuration variable.
This commit is contained in:
parent
281337251d
commit
934640ea62
16
bin/fluents
16
bin/fluents
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python2.4
|
||||
|
||||
from getopt import getopt
|
||||
import os
|
||||
import sys
|
||||
from fluents import fluents, project, workflow
|
||||
import workflows
|
||||
|
@ -20,7 +21,17 @@ def list_workflows():
|
|||
print
|
||||
|
||||
def parse_options():
|
||||
conf_files = ['/etc/fluentsrc',
|
||||
os.path.join(os.environ['HOME'], '.fluents')]
|
||||
|
||||
cp = cfgparse.ConfigParser()
|
||||
|
||||
cp.add_option('home', type='string',
|
||||
default=os.environ['HOME'])
|
||||
|
||||
cp.add_option('datadir', type='string',
|
||||
default=os.environ['HOME'])
|
||||
cp.parse()
|
||||
op = optparse.OptionParser()
|
||||
|
||||
op.add_option('-l', '--list-workflows',
|
||||
|
@ -32,6 +43,10 @@ def parse_options():
|
|||
default='emptyview',
|
||||
help='Start with selected workflow')
|
||||
|
||||
for cf in conf_files:
|
||||
if os.path.isfile(cf):
|
||||
cp.add_file(cf)
|
||||
|
||||
return cp.parse(op)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -54,6 +69,7 @@ if __name__ == '__main__':
|
|||
selected_wf = wf
|
||||
|
||||
app = fluents.FluentApp(selected_wf)
|
||||
app.options = options
|
||||
fluents.app = app
|
||||
|
||||
app.set_project(project.Project())
|
||||
|
|
Reference in New Issue