@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve error messages when specifying bad set or list to bin/config

Summary: Fixes T7308. Multiple users have encountered confusion around how they should specify a set or list in JSON; provide examples.

Test Plan:
```
epriestley@orbital ~/dev/phabricator $ ./bin/config set files.image-mime-types true
Usage Exception: Config key 'files.image-mime-types' is of type 'set'. Specify it in JSON. For example:

./bin/config set '{"value1": true, "value2": true}'

epriestley@orbital ~/dev/phabricator $ ./bin/config set cluster.addresses true
Usage Exception: Config key 'cluster.addresses' is of type 'list<string>'. Specify it in JSON. For example:

./bin/config set '["a", "b", "c"]'

epriestley@orbital ~/dev/phabricator $
```

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7308

Differential Revision: https://secure.phabricator.com/D11925

+28 -4
+28 -4
src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
··· 87 87 default: 88 88 $value = json_decode($value, true); 89 89 if (!is_array($value)) { 90 - throw new PhutilArgumentUsageException(pht( 91 - "Config key '%s' is of type '%s'. Specify it in JSON.", 92 - $key, 93 - $type)); 90 + switch ($type) { 91 + case 'set': 92 + $message = pht( 93 + "Config key '%s' is of type '%s'. Specify it in JSON. ". 94 + "For example:\n\n". 95 + ' ./bin/config set \'{"value1": true, "value2": true}\''. 96 + "\n", 97 + $key, 98 + $type); 99 + break; 100 + default: 101 + if (preg_match('/^list</', $type)) { 102 + $message = pht( 103 + "Config key '%s' is of type '%s'. Specify it in JSON. ". 104 + "For example:\n\n". 105 + ' ./bin/config set \'["a", "b", "c"]\''. 106 + "\n", 107 + $key, 108 + $type); 109 + } else { 110 + $message = pht( 111 + 'Config key "%s" is of type "%s". Specify it in JSON.', 112 + $key, 113 + $type); 114 + } 115 + break; 116 + } 117 + throw new PhutilArgumentUsageException($message); 94 118 } 95 119 break; 96 120 }