Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891725
ArcanistPromptsWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistPromptsWorkflow.php
View Options
<?php
final
class
ArcanistPromptsWorkflow
extends
ArcanistWorkflow
{
public
function
getWorkflowName
(
)
{
return
'prompts'
;
}
public
function
supportsToolset
(
ArcanistToolset
$toolset
)
{
return
true
;
}
public
function
getWorkflowInformation
(
)
{
$help
=
pht
(
<<<EOTEXT
Show information about prompts a workflow may execute and configure default
responses.
**Show Prompts**
To show possible prompts a workflow may execute, run:
$ arc prompts <workflow>
EOTEXT
)
;
return
$this
->
newWorkflowInformation
(
)
->
addExample
(
pht
(
'**prompts** __workflow__'
)
)
->
setHelp
(
$help
)
;
}
public
function
getWorkflowArguments
(
)
{
return
array
(
$this
->
newWorkflowArgument
(
'argv'
)
->
setWildcard
(
true
)
,
)
;
}
public
function
runWorkflow
(
)
{
$argv
=
$this
->
getArgument
(
'argv'
)
;
if
(
!
$argv
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Provide a workflow to list prompts for.'
)
)
;
}
$runtime
=
$this
->
getRuntime
(
)
;
$workflows
=
$runtime
->
getWorkflows
(
)
;
$workflow_key
=
array_shift
(
$argv
)
;
$workflow
=
idx
(
$workflows
,
$workflow_key
)
;
if
(
!
$workflow
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Workflow "%s" is unknown. Supported workflows are: %s.'
,
$workflow_key
,
implode
(
', '
,
array_keys
(
$workflows
)
)
)
)
;
}
$prompts
=
$workflow
->
getPromptMap
(
)
;
if
(
!
$prompts
)
{
echo
tsprintf
(
"%s\n"
,
pht
(
'This workflow can not prompt.'
)
)
;
return
0
;
}
foreach
(
$prompts
as
$prompt
)
{
echo
tsprintf
(
"**%s**\n"
,
$prompt
->
getKey
(
)
)
;
echo
tsprintf
(
"%s\n"
,
$prompt
->
getDescription
(
)
)
;
}
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 15:39 (7 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126085
Default Alt Text
ArcanistPromptsWorkflow.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment