projects
/
cdist.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
45e8c87
)
Make template config file if none exists.
author
Carl Hetherington
<cth@carlh.net>
Sun, 23 Feb 2020 18:44:11 +0000
(19:44 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Sun, 23 Feb 2020 18:44:11 +0000
(19:44 +0100)
cdist
patch
|
blob
|
history
diff --git
a/cdist
b/cdist
index 139968052bf63298b20b3b788443b4bf55f327df..71ab475e301b50b2f20f0ae56cd61a4a51430258 100755
(executable)
--- a/
cdist
+++ b/
cdist
@@
-114,6
+114,18
@@
class Config:
Option('flatpak_state_dir'),
Option('parallel', multiprocessing.cpu_count()) ]
Option('flatpak_state_dir'),
Option('parallel', multiprocessing.cpu_count()) ]
+ config_dir = '%s/.config' % os.path.expanduser('~')
+ if not os.path.exists(config_dir):
+ os.mkdir(config_dir)
+ config_file = '%s/cdist' % config_dir
+ if not os.path.exists(config_file):
+ f = open(config_file, 'w')
+ for o in self.options:
+ print('# %s ' % o.key, file=f)
+ f.close()
+ print('Template config file written to %s; please edit and try again.' % config_file, file=sys.stderr)
+ sys.exit(1)
+
try:
f = open('%s/.config/cdist' % os.path.expanduser('~'), 'r')
while True:
try:
f = open('%s/.config/cdist' % os.path.expanduser('~'), 'r')
while True: