diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-02-23 19:44:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-02-23 19:44:11 +0100 |
| commit | 4ec5d0ed0f595309cb150201c87d25d17c62f099 (patch) | |
| tree | d97012dfdbe724dd964e36c1083a661ad4b55a5a | |
| parent | aca0aa741e53b3ca3e884be1cd863acbb12f1bb5 (diff) | |
Make template config file if none exists.
| -rwxr-xr-x | cdist | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -114,6 +114,18 @@ class Config: 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: |
