~ubuntu-branches/ubuntu/vivid/phabricator/vivid-proposed

« back to all changes in this revision

Viewing changes to libphutil/scripts/test/prompt.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2014-10-23 20:49:26 UTC
  • mfrom: (0.2.1) (0.1.1)
  • Revision ID: package-import@ubuntu.com-20141023204926-vq80u1op4df44azb
Tags: 0~git20141023-1
Initial release (closes: #703046)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env php
 
2
<?php
 
3
 
 
4
require_once dirname(__FILE__).'/../__init_script__.php';
 
5
 
 
6
$args = new PhutilArgumentParser($argv);
 
7
$args->setTagline('test console prompting');
 
8
$args->setSynopsis(<<<EOHELP
 
9
**prompt.php** __options__
 
10
    Test console prompting.
 
11
EOHELP
 
12
);
 
13
$args->parseStandardArguments();
 
14
$args->parse(
 
15
  array(
 
16
    array(
 
17
      'name'    => 'history',
 
18
      'param'   => 'file',
 
19
      'default' => '',
 
20
      'help'    => 'Use specified history __file__.',
 
21
    ),
 
22
    array(
 
23
      'name'    => 'prompt',
 
24
      'param'   => 'text',
 
25
      'default' => 'Enter some text:',
 
26
      'help'    => 'Change the prompt text to __text__.',
 
27
    ),
 
28
  ));
 
29
 
 
30
$result = phutil_console_prompt(
 
31
  $args->getArg('prompt'),
 
32
  $args->getArg('history'));
 
33
 
 
34
$console = PhutilConsole::getConsole();
 
35
$console->writeOut("Input is: %s\n", $result);