From 9e223577aa95ea56b0907035bb50bbba5ae47d24 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 12 Apr 2023 20:45:50 +0200 Subject: [PATCH] Fix `composer require` completion When no development dependencies are installed, the completion would crash with: KeyError: 'require-dev' --- share/completions/composer.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/composer.fish b/share/completions/composer.fish index f32703400..22839867d 100644 --- a/share/completions/composer.fish +++ b/share/completions/composer.fish @@ -29,7 +29,7 @@ import json json_data = open('composer.json') data = json.load(json_data) json_data.close() -packages = itertools.chain(data['require'].keys(), data['require-dev'].keys()) +packages = itertools.chain(data.get('require', {}).keys(), data.get('require-dev', {}).keys()) print(\"\n\".join(packages)) " | $python -S end