feat(install): configure custom status line
This commit is contained in:
1 parent
0d034f4299
commit
ee19c64beb
14 files changed
+101
-315
No files matched your search
@@ -12,7 +12,7 @@ def validate(state, allow_legacy=False):
|
||||
if not allow_legacy:
|
||||
raise ValueError('Saved selection predates install options. Run update once without Quick.')
|
||||
state = dict(state, version=2, shell={'windows': 'powershell', 'linux': 'bash'}.get(state.get('platform')),
|
||||
update_agents=False, flashbang=True)
|
||||
flashbang=True, statusline=True)
|
||||
state.pop('platform', None)
|
||||
if not isinstance(state, dict) or state.get('version') != 2:
|
||||
raise ValueError('Unsupported saved selection.')
|
||||
@@ -20,7 +20,10 @@ def validate(state, allow_legacy=False):
|
||||
raise ValueError('Invalid saved shell or client.')
|
||||
if 'semantic_retrieval' not in state:
|
||||
state['semantic_retrieval'] = False
|
||||
if any(type(state.get(key)) is not bool for key in ('update_agents', 'flashbang', 'semantic_retrieval')):
|
||||
if 'statusline' not in state:
|
||||
state['statusline'] = True
|
||||
state.pop('update_agents', None)
|
||||
if any(type(state.get(key)) is not bool for key in ('flashbang', 'statusline', 'semantic_retrieval')):
|
||||
raise ValueError('Invalid saved install options. Run update once without Quick.')
|
||||
for key in ('selected', 'deselected'):
|
||||
values = state.get(key)
|
||||
@@ -41,8 +44,8 @@ def main():
|
||||
parser.add_argument('--format', choices=('json', 'tsv'), default='json')
|
||||
parser.add_argument('--shell')
|
||||
parser.add_argument('--allow-legacy', action='store_true')
|
||||
parser.add_argument('--update-agents', choices=('true', 'false'))
|
||||
parser.add_argument('--flashbang', choices=('true', 'false'))
|
||||
parser.add_argument('--statusline', choices=('true', 'false'))
|
||||
parser.add_argument('--semantic-retrieval', choices=('true', 'false'))
|
||||
parser.add_argument('--client')
|
||||
parser.add_argument('--selected', nargs='*', default=[])
|
||||
@@ -62,15 +65,15 @@ def main():
|
||||
else:
|
||||
print('shell\t' + state['shell'])
|
||||
print('client\t' + state['client'])
|
||||
for key in ('update_agents', 'flashbang', 'semantic_retrieval'):
|
||||
for key in ('flashbang', 'statusline', 'semantic_retrieval'):
|
||||
print(key + '\t' + str(state[key]).lower())
|
||||
for key in ('selected', 'deselected'):
|
||||
for name in state[key]:
|
||||
print(key + '\t' + name)
|
||||
return
|
||||
state = validate(dict(version=2, shell=args.shell, client=args.client,
|
||||
update_agents=None if args.update_agents is None else args.update_agents == 'true',
|
||||
flashbang=None if args.flashbang is None else args.flashbang == 'true',
|
||||
flashbang=True if args.flashbang is None else args.flashbang == 'true',
|
||||
statusline=True if args.statusline is None else args.statusline == 'true',
|
||||
semantic_retrieval=False if args.semantic_retrieval is None else args.semantic_retrieval == 'true',
|
||||
selected=args.selected, deselected=args.deselected))
|
||||
if (set(state['selected']) | set(state['deselected'])) - names:
|
||||
|
||||
Reference in new issue
Block a user