Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2896264
interactive_editor.php
No One
Temporary
Actions
View 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
interactive_editor.php
View Options
#!/usr/bin/env php
<?php
require_once
dirname
(
__FILE__
)
.
'/../__init_script__.php'
;
$args
=
new
PhutilArgumentParser
(
$argv
)
;
$args
->
setTagline
(
pht
(
'test %s class'
,
'InteractiveEditor'
)
)
;
$args
->
setSynopsis
(
<<<EOHELP
**interactive_editor.php** [__options__]
Edit some content via the InteractiveEditor class. This script
makes it easier to test changes to InteractiveEditor, which is
difficult to unit test.
EOHELP
)
;
$args
->
parseStandardArguments
(
)
;
$args
->
parse
(
array
(
array
(
'name'
=>
'fallback'
,
'param'
=>
'editor'
,
'help'
=>
pht
(
'Set the fallback editor.'
)
,
)
,
array
(
'name'
=>
'line'
,
'short'
=>
'l'
,
'param'
=>
'number'
,
'help'
=>
pht
(
'Open at line number __number__.'
)
,
)
,
array
(
'name'
=>
'name'
,
'param'
=>
'filename'
,
'help'
=>
pht
(
'Set edited file name.'
)
,
)
,
)
)
;
if
(
$args
->
getArg
(
'help'
)
)
{
$args
->
printHelpAndExit
(
)
;
}
$editor
=
new
PhutilInteractiveEditor
(
pht
(
"The wizard quickly\njinxed the gnomes\nbefore they vaporized."
)
)
;
$name
=
$args
->
getArg
(
'name'
)
;
if
(
$name
)
{
$editor
->
setName
(
$name
)
;
}
$line
=
$args
->
getArg
(
'line'
)
;
if
(
$line
)
{
$editor
->
setLineOffset
(
$line
)
;
}
$fallback
=
$args
->
getArg
(
'fallback'
)
;
if
(
$fallback
)
{
$editor
->
setFallbackEditor
(
$fallback
)
;
}
$result
=
$editor
->
editInteractively
(
)
;
echo
pht
(
'Edited Text:'
)
.
"\n{$result}\n"
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jan 19 2025, 22:50 (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129562
Default Alt Text
interactive_editor.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment