PK! qconfedit/__init__.py__version__ = '0.1.0' PK!R.confedit/conf.py#!/usr/bin/env python3 from os import environ, listdir from os.path import join, expanduser from pathlib import Path from subprocess import run from click import argument, command from pick import pick POTENTIAL_FILENAMES = ('config.toml', 'config.yaml', 'config.yml', 'config.fish') CONFIG_HOME = Path(environ.get('XDG_CONFIG_HOME', '~/.config')).expanduser() SETUP = Path.home() / '.setup' def get_nonstandard_configpath(app: str) -> Path: paths = { 'brew': SETUP / 'bin' / 'install-brew-stuff' } return paths.get(app, None) @command() @argument('app') def conf(app): nonstandard_path = get_nonstandard_configpath(app) if nonstandard_path: config_file = nonstandard_path else: if CONFIG_HOME / app in CONFIG_HOME.iterdir(): app_config_dir = CONFIG_HOME / app files = list(app_config_dir.iterdir()) if len(files) == 0: print(f'Empty config directory {app_config_dir}') return elif len(files) == 1: config_file = files[0] else: config_file, _ = pick(files, 'Which file do you want to edit?') # for filename in POTENTIAL_FILENAMES: # if app_config_dir / filename in app_config_dir.iterdir(): # config_file = app_config_dir / filename run([environ['EDITOR'], str(config_file)])PK!H:Z")confedit-0.1.0.dist-info/entry_points.txtN+I/N.,() ق+PK!HnHTUconfedit-0.1.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!He!confedit-0.1.0.dist-info/METADATAAO0 9Z( H21g+E=ߓ 7n{@v8`B1qZ^LHK:ķ`JlG0wQG}|mEÆ|%܌[ZcF6!$'$k}k;`O1rTnV9TE=n{LwL9}r z;RRg6MP\_sCz6l@(EQ+&PK!Hj,confedit-0.1.0.dist-info/RECORDuͻr@@oaHAYE6;EȲdܼm%B!>1K++q;! Z[@U띗RFL?H)"&wY@y2bЮuKY=P2{ڳI㷑4R:v>=k`^ 5QzvgNF>F.FW7b1Ҧ[)&{(m&G=;0,#0fwt\Zc]C=$^yG9Fke=&-YPK! qconfedit/__init__.pyPK!R.Hconfedit/conf.pyPK!H:Z")confedit-0.1.0.dist-info/entry_points.txtPK!HnHTU[confedit-0.1.0.dist-info/WHEELPK!He!confedit-0.1.0.dist-info/METADATAPK!Hj,confedit-0.1.0.dist-info/RECORDPKq