Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prefix"
version = "1.2.0"
version = "1.2.1"
authors = ["Shivix"]
edition = "2021"
description = "A customizable pretty printer for FIX messages"
Expand Down
4 changes: 2 additions & 2 deletions completion/_prefix
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ _prefix() {
'--strict[Only consider full FIX messages containing both BeginString and Checksum]' \
'-s[Strip the whitespace around the = in each field]' \
'--strip[Strip the whitespace around the = in each field]' \
'-t[Translate tag numbers on non FIX message lines]' \
'--tag[Translate tag numbers on non FIX message lines]' \
'-t[Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it'\''s number]' \
'--tag[Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it'\''s number]' \
'-v[Translate the values of some tags (for Side\: 1 -> Buy)]' \
'--value[Translate the values of some tags (for Side\: 1 -> Buy)]' \
'-h[Print help]' \
Expand Down
4 changes: 2 additions & 2 deletions completion/_prefix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Register-ArgumentCompleter -Native -CommandName 'prefix' -ScriptBlock {
[CompletionResult]::new('--strict', 'strict', [CompletionResultType]::ParameterName, 'Only consider full FIX messages containing both BeginString and Checksum')
[CompletionResult]::new('-s', 's', [CompletionResultType]::ParameterName, 'Strip the whitespace around the = in each field')
[CompletionResult]::new('--strip', 'strip', [CompletionResultType]::ParameterName, 'Strip the whitespace around the = in each field')
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Translate tag numbers on non FIX message lines')
[CompletionResult]::new('--tag', 'tag', [CompletionResultType]::ParameterName, 'Translate tag numbers on non FIX message lines')
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it''s number')
[CompletionResult]::new('--tag', 'tag', [CompletionResultType]::ParameterName, 'Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it''s number')
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Translate the values of some tags (for Side: 1 -> Buy)')
[CompletionResult]::new('--value', 'value', [CompletionResultType]::ParameterName, 'Translate the values of some tags (for Side: 1 -> Buy)')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
Expand Down
2 changes: 1 addition & 1 deletion completion/prefix.fish
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ complete -c prefix -l porcelain -d 'print FIX messages closer to standard format
complete -c prefix -s r -l repeating -d 'Combine any repeating groups into a single field with a comma delimited value'
complete -c prefix -s f -l strict -d 'Only consider full FIX messages containing both BeginString and Checksum'
complete -c prefix -s s -l strip -d 'Strip the whitespace around the = in each field'
complete -c prefix -s t -l tag -d 'Translate tag numbers on non FIX message lines'
complete -c prefix -s t -l tag -d 'Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it\'s number'
complete -c prefix -s v -l value -d 'Translate the values of some tags (for Side: 1 -> Buy)'
complete -c prefix -s h -l help -d 'Print help'
complete -c prefix -s V -l version -d 'Print version'
6 changes: 3 additions & 3 deletions man/prefix.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH prefix 1 "prefix 1.2.0"
.TH prefix 1 "prefix 1.2.1"
.SH NAME
prefix \- A customizable pretty printer for FIX messages
.SH SYNOPSIS
Expand Down Expand Up @@ -38,7 +38,7 @@ Strip the whitespace around the = in each field
Summarise each fix message based on an optional template
.TP
\fB\-t\fR, \fB\-\-tag\fR
Translate tag numbers on non FIX message lines
Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it\*(Aqs number
.TP
\fB\-v\fR, \fB\-\-value\fR
Translate the values of some tags (for Side: 1 \-> Buy)
Expand All @@ -52,4 +52,4 @@ Print version
[\fImessage\fR]
FIX message to be parsed, if not provided will look for a message piped through stdin
.SH VERSION
v1.2.0
v1.2.1
2 changes: 1 addition & 1 deletion src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn make_command() -> Command {
.default_missing_value("")
)
.arg(
arg!(-t --tag "Translate tag numbers on non FIX message lines")
arg!(-t --tag "Translate tag numbers on non FIX message lines, if the entire line matches a tag name it will print it's number")
.action(ArgAction::SetTrue)
)
.arg(
Expand Down
7 changes: 7 additions & 0 deletions src/prefix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ fn parse_fix_msg(input: &str, regex: &Regex) -> FixMsg {
}

fn parse_tags(input: &str, regex: &Regex) -> String {
if input.chars().all(|c| !c.is_ascii_digit()) {
for (tag, tag_name) in tags::TAGS.iter().enumerate() {
if input.to_lowercase() == tag_name.to_lowercase() && !tag_name.is_empty() {
return tag.to_string();
}
}
}
let mut result = input.to_owned();
for m in regex.find_iter(input) {
let tag = m.as_str().parse::<usize>().unwrap();
Expand Down