-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alr.Commands: add support for aliases
- Loading branch information
1 parent
d48e8df
commit 9205502
Showing
7 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
with AAA.Strings; | ||
|
||
with CLIC.Subcommand; | ||
|
||
package Alr.Commands.Topics.Aliases is | ||
|
||
type Topic is new CLIC.Subcommand.Help_Topic with null record; | ||
|
||
overriding | ||
function Name (This : Topic) return CLIC.Subcommand.Identifier | ||
is ("aliases"); | ||
|
||
overriding | ||
function Title (This : Topic) return String | ||
is ("User defined command aliases"); | ||
|
||
overriding | ||
function Content (This : Topic) return AAA.Strings.Vector | ||
is (AAA.Strings.Empty_Vector | ||
.Append ("Command aliases can be defined in local or global ") | ||
.Append ("configuration.") | ||
.New_Line | ||
.Append ("For example the following command:") | ||
.Append ("""$ alr config --set --global alias.graph 'show --graph'""") | ||
.Append ("Defines a global alias for the 'show' command with a ") | ||
.Append ("'--graph' switch.") | ||
.New_Line | ||
.Append ("""$ alr graph"" is equivalent to ""alr show --graph""")); | ||
|
||
end Alr.Commands.Topics.Aliases; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Basic check of alias definition in configuration | ||
""" | ||
|
||
from glob import glob | ||
import os | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
|
||
import re | ||
|
||
# Get the "hello" project and enter its directory | ||
run_alr('get', 'hello') | ||
os.chdir(glob('hello*')[0]) | ||
|
||
# Define an alias locally | ||
run_alr('config', '--set', 'alias.my_alias', 'exec echo Test an alias') | ||
|
||
# Use the alias | ||
p = run_alr('my_alias', | ||
quiet=False) # -q will hide the output of the exec command | ||
|
||
assert_match('Test an alias', p.out, flags=re.S) | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
driver: python-script | ||
indexes: | ||
basic_index: {} |