Page MenuHomePhabricator

D19751.diff
No OneTemporary

D19751.diff

diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
--- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
@@ -20,9 +20,11 @@
'help' => pht('Set lease expiration time.'),
),
array(
- 'name' => 'attributes',
- 'param' => 'name=value,...',
- 'help' => pht('Resource specification.'),
+ 'name' => 'attributes',
+ 'param' => 'file',
+ 'help' => pht(
+ 'JSON file with lease attributes. Use "-" to read attributes '.
+ 'from stdin.'),
),
));
}
@@ -49,11 +51,20 @@
}
}
- $attributes = $args->getArg('attributes');
- if ($attributes) {
- $options = new PhutilSimpleOptions();
- $options->setCaseSensitive(true);
- $attributes = $options->parse($attributes);
+ $attributes_file = $args->getArg('attributes');
+ if (strlen($attributes_file)) {
+ if ($attributes_file == '-') {
+ echo tsprintf(
+ "%s\n",
+ 'Reading JSON attributes from stdin...');
+ $data = file_get_contents('php://stdin');
+ } else {
+ $data = Filesystem::readFile($attributes_file);
+ }
+
+ $attributes = phutil_json_decode($data);
+ } else {
+ $attributes = array();
}
$lease = id(new DrydockLease())

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 1:00 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7362472
Default Alt Text
D19751.diff (1 KB)

Event Timeline