Crates.io | edi-format |
lib.rs | edi-format |
version | 0.2.0 |
source | src |
created_at | 2024-04-27 13:05:53.72485 |
updated_at | 2024-05-17 21:36:02.787107 |
description | EDIFACT Formatter |
homepage | |
repository | https://github.com/zahidkizmaz/edi-format |
max_upload_size | |
id | 1222609 |
size | 52,760 |
Simple EDI file formatter.
cargo install edi-format
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/zahidkizmaz/edi-format/releases/latest/download/edi-format-installer.sh | sh
powershell -c "irm https://github.com/zahidkizmaz/edi-format/releases/latest/download/edi-format-installer.ps1 | iex"
Install rust and cargo if you don't have.
git clone https://github.com/zahidkizmaz/edi-format.git
cd edi-format
cargo build --release
./target/release/edi-format --version
edi-format 0.1.0
Usage: edi-format [OPTIONS] <PATH>
Arguments:
<PATH> Path to format
Options:
--dry-run Do not modify the file but show formatted content in stdout
-l, --log-level <LOG_LEVEL> Log level eg: trace, debug, info, warn, error [default: INFO]
-h, --help Print help
-V, --version Print version
$ cat tests/valid_not_formatted.edi
UNA:+.? 'UNB+IATB:1+6XPPC:ZZ+LHPPC:ZZ+940101:0950+1'UNH+1+PAORES:93:1:IA'MSG+1:45'IFT+3+XYZCOMPANY AVAILABILITY'ERC+A7V:1:AMD'IFT+3+NO MORE FLIGHTS'ODI'TVL+240493:1000::1220+FRA+JFK+DL+400+C'PDI++C:3+Y::3+F::1'APD+74C:0:::6++++++6X'TVL+240493:1740::2030+JFK+MIA+DL+081+C'PDI++C:4'APD+EM2:0:1630::6+++++++DA'UNT+13+1'UNZ+1+1'
$ edi-format --dry-run tests/valid_not_formatted.edi
2024-04-27T06:26:09.441402Z INFO edi_format: Running in dry-run mode
UNA:+.? '
UNB+IATB:1+6XPPC:ZZ+LHPPC:ZZ+940101:0950+1'
UNH+1+PAORES:93:1:IA'
MSG+1:45'
IFT+3+XYZCOMPANY AVAILABILITY'
ERC+A7V:1:AMD'
IFT+3+NO MORE FLIGHTS'
ODI'
TVL+240493:1000::1220+FRA+JFK+DL+400+C'
PDI++C:3+Y::3+F::1'
APD+74C:0:::6++++++6X'
TVL+240493:1740::2030+JFK+MIA+DL+081+C'
PDI++C:4'
APD+EM2:0:1630::6+++++++DA'
UNT+13+1'
UNZ+1+1'%
$ cat ./tests/valid_formatted.edi | edi-format --stdin
UNA:+.? '
UNB+IATB:1+6XPPC:ZZ+LHPPC:ZZ+940101:0950+1'
UNH+1+PAORES:93:1:IA'
MSG+1:45'
IFT+3+XYZCOMPANY AVAILABILITY'
ERC+A7V:1:AMD'
IFT+3+NO MORE FLIGHTS'
ODI'
TVL+240493:1000::1220+FRA+JFK+DL+400+C'
PDI++C:3+Y::3+F::1'
APD+74C:0:::6++++++6X'
TVL+240493:1740::2030+JFK+MIA+DL+081+C'
PDI++C:4'
APD+EM2:0:1630::6+++++++DA'
UNT+13+1'
UNZ+1+1'%
Neovim: add edi
filetype
vim.filetype.add({
extension = { edi = "edi" },
})
Example efm-langserver config
version: 2
tools:
edi-format: &edi-format
format-stdin: true
format-command: 'edi-format -l error --stdin'
languages:
edi:
- <<: *edi-format