Skip to content

Aliases do not resepect parenthesis escaping #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2014
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@

- `session:export:view`: Added `--pretty` option to `session:export:view` command to output formatted XML.
- `session:export:view`: Ask confirmation before overwriting file.

## Bug Fixes

- Aliases: Allow quoted arguments
5 changes: 5 additions & 0 deletions features/fixtures/cms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<sv:property sv:name="jcr:mixinTypes" sv:type="name">
<sv:value>mix:shareable</sv:value>
</sv:property>
<sv:node sv:name="Title with Spaces">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>nt:unstructured</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="article1">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>nt:unstructured</sv:value>
Expand Down
11 changes: 7 additions & 4 deletions features/shell_alias.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Feature: Command aliases
Given that I am logged in as "testuser"
And the "cms.xml" fixtures are loaded

Scenario: Execute an alias with a quoted string
Given I execute the "ls 'cms/articles/Title with Spaces'" command
Then the command should not fail


Scenario Outline: Execute an alias
Given I execute the "<command>" command
Then the command should not fail
Expand All @@ -20,16 +25,14 @@ Feature: Command aliases
| mv cms smc |
| ls |
| ls cms |
| sl cms/articles cms/test/foobar |
| ln cms/articles cms/test/foobar |
| cat cms/articles/article1/title |


Scenario: List aliases
Given I execute the "shell:alias:list" command
Then the command should not fail
And I should see a table containing the following rows:
| Alias | Command |
| cd | shell:path:change {arg1} |
| ls | node:list {arg1} |



3 changes: 3 additions & 0 deletions src/PHPCR/Shell/Subscriber/AliasSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public function handleAlias(CommandPreRunEvent $event)
$tokens = $input->getTokens();

foreach ($tokens as $i => $token) {
if (strstr($token, ' ')) {
$token = escapeshellarg($token);
}
$replaces['{arg' . $i . '}'] = $token;
}

Expand Down