Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,6 @@ If the value is not specified, default to `$defaultValue`.

In the case of `boolean()` type flags, when the flag is present, the value of this option the negation of `$defaultValue`. That is to say, if you have a flag -b with a default of `true`, when -b is present as a command line flag, the value of the option will be `false`.

### `file ()`

Aliases: `expectsFile`

The value specified for this option must be a valid file path. When used relative paths will be converted into fully quatified file paths and globbing is also optionally supported. See the file.php example.

## Contributing

Commando highly encourages sending in pull requests. When submitting a pull request please:
Expand Down
2 changes: 1 addition & 1 deletion src/Commando/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function parseFilePath($file_path)
*/
public function getName()
{
return $this->name;
return ($this->title && is_numeric($this->name)) ? $this->title : $this->name;
}

/**
Expand Down
11 changes: 10 additions & 1 deletion tests/Commando/OptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testGetDescription()
$this->assertEquals($description, $option->getDescription());
}

public function testAnnonymousOption()
public function testAnonymousOption()
{
$option = new Option(0);

Expand All @@ -43,6 +43,15 @@ public function testAnnonymousOption()
$this->assertEquals(1, $anon_option->getName());
}

public function testAnonymousOptionWithTitle()
{
$expected = 'test';
$option = new Option(0);
$option->setTitle($expected);

$this->assertEquals($expected, $option->getName());
}

public function testAddAlias()
{
$name = 'f';
Expand Down