Add a read-execute-print-loop prompt for Cmdline #2273
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2161.
Background
CKAN's Cmdline interface executes one command and then exits. Scripts can be written with CKAN, but they require CKAN to be executed once per command, with the cost of parsing
registry.json
incurred for each command.Changes
A new
ckan prompt
command is created that:registry.json
once for a given instance across multiple commands, so you don't have to wait several seconds between operationsCommonOptions
flags over to the commands it runs (mainly to make a top-level--headless
work properly)Line break added before the
install
command to simulate having the screen pause for input:ckan prompt --headless
now works kind of like a CKAN scripting language:Other changes
Execute
function to make it easier to parse and run commands from other commands. This also allowed us to centralize theDisposeAll
calls that each subcommand previously had to handle itself.CompatSubCommand
is renamed toCompat
for consistency with other subcommandsNot Done Yet
Tab completion as in #888 and #2174 is not implemented. It should be possible to add it to
Prompt.cs
's input driver. (Or it might be cleaner to do bash completion instead.)