Sublime-Z is a plugin for Sublime Text 3 to edit and test ARIZ files.
- Add any section using command or menu item
- Add all section headers using command or menu item (
Add all section headers
) - Format all sections using command or menu item (
Format all sections
) - when Table Editor plugin is installed - Add missing sections and format all sections using command or menu item (
Reformat ARIZ
) - TableEditor plugin is required - Use aclr8 either from a binary or source code
- Run aclr8 tests
- Run single query
- Check aclr8 version
- Add ARIZ ION examples
- Filter Ion
- Make use of ANSI escape codes when ANSIescape plugin in installed
The simplest way is to install this plugin using Package Control:
- Install Package Control
- Add this repository to Package Control repositories:
- open command input (
[shift] + [ctrl] + [p]
) - type "add repository" and press
Enter
- paste this repository url:
https://github.com/synek317/subz.git
and pressEnter
- Install Sublime-Z package:
- open command input (
[shift] + [ctrl] + [p]
) - type "install package" and press
Enter
- type "subz" and press
Enter
Alternatively you can clone this repository, rename it to subz
and move it to your packages directory. Depending on your system it is:
- Windows:
%APPDATA%\Sublime Text 3
- OS X:
~/Library/Application Support/Sublime Text 3
- Linux:
~/.config/sublime-text-3
ARIZ file editting is definitely easier with following packages installed:
- MarkdownTableFormatter for formatting sections
- ANSIescape for coloring tests output
In order to run aclr8-related commands, Sublime-Z must be able to find aclr8. Its path is stored in Sublime-Z settings in aclr8_path
key.
You may provide there
- just the executable name if it is included in your
PATH
env variable - absolute path to the executable (with or without
.exe
extension) - absolute path to the root of aclr8 source
It may be good idea to first run check aclr8 version
command and see if it works. If aclr8 is not found, Sublime-Z will ask you to enter the path. Check recipes for more details.
- There are two versions of
[CONTRACT]
section. Theminimal
one inserts only minimum number of required properties whilefull
inserts all possible properties. - You don't have to type whole command. Typically, section name is enough to narrow down search results to single item.
- Output panel (at the bottom of the window) can be quickly closed by pressing
[Esc]
- When some of the tests are failing, new tab will be opened. It ignores any changes and can be quickly closed by pressing
[ctrl] + w
- You don't have to save the
.ion
file in order to run tests or query - Use
Reformat ARIZ
command to add all sections headers and apply formatting - Use
Run aclr8 tests coupled
to run tests for contracts with SPO and cross contracts - Commands
Run aclr8 query
andRun aclr8 query coupled
require dates in ions greater or equal today date
- CONTRACT
- CONFIG
- CUSTOM_INFO
- QUERY_TRANSFORM
- DEF_HOTEL
- DEF_MEAL
- DEF_ROOM
- RATE_PLAN
- RATE_BASE
- RATE_SUPPLEMENT
- RATE_SUPPLEMENT_CAT
- RATE_DISCOUNT
- RATE_DISCOUNT_GROUP
- RATE_DISCOUNT_CAT
- TAX
- TAX_GROUP
- RATE_RULE
- RESTRICTION
- RATE_CNX
- AVL.INV
- AVL.STATE
- AVL.BUCKET_STATE
- TEST
- Run the command
a. with mouse: choose
Tools -> Sublime-Z -> Aclr8 -> Check aclr8 version
b. with keyboard: press[shift] + [ctrl] + p
to open command input and then typeCheck aclr8 version
- If aclr8 is not found, you have to provide it in the input box that pops up at the bottom of the window and confirm with
[Enter]
- When everything is configured correctly, the command and aclr8 version should be shown in the output panel at the bottom of the window
- Create new file (
File -> New File
or[ctrl] + n
) - Insert sections using either menu or command
a. with mouse: choose
Tools -> Sublime-Z -> Insert Section
and then choose selected section b. with keyboard: press[shift] + [ctrl] + p
to open command input and then typeInsert [TEST] section
. ReplaceTEST
with any section name.
- Create ARIZ as described previously
- Open query input
a. with mouse: choose
Tools -> Sublime-Z -> Aclr8 -> Run aclr8 query
b. with keyboard: press[shift] + [ctrl] + p
to open command input and then typeRun aclr8 query
- Fill the query in the input box (by default it shows up at the bottom of the window) and press
[Enter]
when ready - The results should appear in the output panel.
- Create ARIZ as described previously
- Open query input
a. with mouse: choose
Tools -> Sublime-Z -> Aclr8 -> Run aclr8 tests
b. with keyboard: press[shift] + [ctrl] + p
to open command input and then typeRun aclr8 tests
- If all tests pass, short message will appear in the output panel
- Otherwise, the output will appear in the
Sublime-Z Results
tab
- Open Sublime-Z settings:
Preferences -> Package Settings -> Sublime-Z -> Settings - User
- Set new aclr8i path in
aclr8_path
key, e.g.
{
"aclr8_path": "/opt/aclr8i"
}
- Create ARIZ as described previously
- Open Filter input
a. with mouse: choose
Tools -> Sublime-Z -> Filter Ion
b. with keyboard: press[shift] + [ctrl] + p
to open command input and then typeFilter Ion
c. with keyboard shortcut: press[ctrl] + i, o
to open command input Required three groups of arguments separated by ":" - search_arguments:section_arguments:text_to_search Options: Search arguments (can be separated by comma delimiter): r - regex search, s - string search (DEFAULT), d - date search, i - lines including search text (DEFAULT), e - lines excluding search text Sections arguments (can be separated by comma delimiter): ba - sections: RATE.BASE, RATE.SUPPLEMENT, RATE.DISCOUNT, RATE.RULE, RESTRICTION, DEF.ROOM, te - TEST, co - CONTRACT, dh - DEF.HOTEL, dm - DEF.MEAL, dr - DEF.ROOM, rp - RATE.PLAN, rb - RATE.BASE, ru - RATE.RULE, rs - RATE.SUPPLEMENT, sc - RATE.SUPPLEMENT_CAT, rd - RATE.DISCOUNT, dc - RATE.DISCOUNT_CAT, dg - RATE.DISCOUNT_GROUP, rr - RESTRICTION, qt - QUERY.TRANSFORM, rc - RATE.CNX, ta - TAX, tg - TAX_GROUP, rm - RATE.MARKUP, ab - AVL.BUCKET_STATE, as - AVL.STATE, ai - AVL.INV, cf - CONFIG, ci - CUSTOM_INFO Example commands::dr:P1:2
- search for lines including stringP1:2
inDEF.ROOM
sectionde:rb:20180101:20180110
- search for lines inRATE.BASE
section which dose not contain passed date in sectionDATES
columnri:rs,rd:P[1-2]
- search lines matching regex inRATE.SUPPLEMENT
andRATE.DISCOUNT
sections - To display help write
h
and press Enter