@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.

Make the success message from "bin/config" more clear

Summary:
Ref T13373. When you "bin/config set x ..." a value, the success message ("Set x ...") is somewhat ambiguous and can be interpreted as "First, you need to set x..." rather than "Success, wrote x...".

Make the messaging more explicit. Also make this string more translatable.

Test Plan: Ran `bin/config set ...` with various combinations of flags, saw more clear messaging.

Maniphest Tasks: T13373

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

+33 -16
+28 -16
src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
··· 30 30 } 31 31 32 32 public function execute(PhutilArgumentParser $args) { 33 - $console = PhutilConsole::getConsole(); 34 33 $argv = $args->getArg('args'); 35 - if (count($argv) == 0) { 34 + if (!$argv) { 36 35 throw new PhutilArgumentUsageException( 37 - pht('Specify a configuration key and a value to set it to.')); 36 + pht('Specify the configuration key you want to set.')); 38 37 } 39 38 40 39 $is_stdin = $args->getArg('stdin'); ··· 45 44 if (count($argv) > 1) { 46 45 throw new PhutilArgumentUsageException( 47 46 pht( 48 - 'Too many arguments: expected only a key when using "--stdin".')); 47 + 'Too many arguments: expected only a configuration key when '. 48 + 'using "--stdin".')); 49 49 } 50 50 51 51 fprintf(STDERR, tsprintf("%s\n", pht('Reading value from stdin...'))); ··· 54 54 if (count($argv) == 1) { 55 55 throw new PhutilArgumentUsageException( 56 56 pht( 57 - "Specify a value to set the key '%s' to.", 57 + 'Specify a value to set the configuration key "%s" to, or '. 58 + 'use "--stdin" to read a value from stdin.', 58 59 $key)); 59 60 } 60 61 ··· 67 68 $value = $argv[1]; 68 69 } 69 70 70 - 71 71 $options = PhabricatorApplicationConfigOptions::loadAllOptions(); 72 72 if (empty($options[$key])) { 73 73 throw new PhutilArgumentUsageException( 74 74 pht( 75 - "No such configuration key '%s'! Use `%s` to list all keys.", 76 - $key, 77 - 'config list')); 75 + 'Configuration key "%s" is unknown. Use "bin/config list" to list '. 76 + 'all known keys.', 77 + $key)); 78 78 } 79 79 80 80 $option = $options[$key]; ··· 99 99 switch ($type) { 100 100 default: 101 101 $message = pht( 102 - 'Config key "%s" is of type "%s". Specify it in JSON.', 102 + 'Configuration key "%s" is of type "%s". Specify it in JSON.', 103 103 $key, 104 104 $type); 105 105 break; ··· 128 128 } 129 129 130 130 if ($use_database) { 131 - $config_type = 'database'; 132 131 $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); 133 132 $config_entry->setValue($value); 134 133 ··· 136 135 $config_entry->setIsDeleted(0); 137 136 138 137 $config_entry->save(); 138 + 139 + $write_message = pht( 140 + 'Wrote configuration key "%s" to database storage.', 141 + $key); 139 142 } else { 140 - $config_type = 'local'; 141 - id(new PhabricatorConfigLocalSource()) 143 + $config_source = id(new PhabricatorConfigLocalSource()) 142 144 ->setKeys(array($key => $value)); 145 + 146 + $local_path = $config_source->getReadablePath(); 147 + 148 + $write_message = pht( 149 + 'Wrote configuration key "%s" to local storage (in file "%s").', 150 + $key, 151 + $local_path); 143 152 } 144 153 145 - $console->writeOut( 146 - "%s\n", 147 - pht("Set '%s' in %s configuration.", $key, $config_type)); 154 + echo tsprintf( 155 + "<bg:green>** %s **</bg> %s\n", 156 + pht('DONE'), 157 + $write_message); 158 + 159 + return 0; 148 160 } 149 161 150 162 }
+5
src/infrastructure/env/PhabricatorConfigLocalSource.php
··· 65 65 return $path; 66 66 } 67 67 68 + public function getReadablePath() { 69 + $path = $this->getConfigPath(); 70 + return Filesystem::readablePath($path); 71 + } 72 + 68 73 }