Skip to content

Commit

Permalink
Add --columns option to lists (#76)
Browse files Browse the repository at this point in the history
* Add --columns option to lists

* Run actions always

* Revert "Run actions always"

This reverts commit 403e9e3.

* Add columns option to modality list

* Add more tests

* And more

* Make it nicer

* Add another unit test
  • Loading branch information
Ch00k authored Mar 19, 2021
1 parent 61bcc6d commit 045f2c5
Show file tree
Hide file tree
Showing 21 changed files with 964 additions and 185 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tempfile = "3.2"
zip = "0.5"

# https://github.com/colin-kiegel/rust-pretty-assertions/issues/19#issuecomment-657672143
[profile.dev.package.difference]
[profile.dev.package.diff]
opt-level = 3

[build-dependencies]
Expand Down
24 changes: 24 additions & 0 deletions completion/_orthanc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ case $state in
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID PatientName]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID PatientName]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand All @@ -70,6 +72,8 @@ _arguments "${_arguments_options[@]}" \
;;
(list-studies)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID AccessionNumber StudyDate]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID AccessionNumber StudyDate]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand All @@ -83,6 +87,8 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
'*-q+[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: PatientSex=F PatientName=*Sanchez*]' \
'*--query=[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: PatientSex=F PatientName=*Sanchez*]' \
'*-c+[Display only the columns specified. Space-separated values. Example: ID PatientName]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID PatientName]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand Down Expand Up @@ -164,6 +170,8 @@ case $state in
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID AccessionNumber StudyDate]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID AccessionNumber StudyDate]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand All @@ -183,6 +191,8 @@ _arguments "${_arguments_options[@]}" \
;;
(list-series)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID Modality BodyPartExamined]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID Modality BodyPartExamined]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand All @@ -196,6 +206,8 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
'*-q+[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: StudyDescription=*BRAIN* StudyDate=20200101]' \
'*--query=[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: StudyDescription=*BRAIN* StudyDate=20200101]' \
'*-c+[Display only the columns specified. Space-separated values. Example: ID AccessionNumber StudyDate]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID AccessionNumber StudyDate]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand Down Expand Up @@ -277,6 +289,8 @@ case $state in
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID Modality BodyPartExamined]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID Modality BodyPartExamined]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand All @@ -296,6 +310,8 @@ _arguments "${_arguments_options[@]}" \
;;
(list-instances)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID InstanceCreationDate]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID InstanceCreationDate]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand All @@ -309,6 +325,8 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
'*-q+[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: SeriesDescription=*BRAIN* SeriesDate=20200101]' \
'*--query=[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: SeriesDescription=*BRAIN* SeriesDate=20200101]' \
'*-c+[Display only the columns specified. Space-separated values. Example: ID Modality BodyPartExamined]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID Modality BodyPartExamined]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand Down Expand Up @@ -390,6 +408,8 @@ case $state in
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: ID InstanceCreationDate]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID InstanceCreationDate]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand Down Expand Up @@ -420,6 +440,8 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
'*-q+[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: InstanceNumber=42 InstanceCreationTime=174242]' \
'*--query=[Search query terms. Space-separted pairs TagName=TagValue. Wildcards are allowed. Example: InstanceNumber=42 InstanceCreationTime=174242]' \
'*-c+[Display only the columns specified. Space-separated values. Example: ID InstanceCreationDate]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: ID InstanceCreationDate]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand Down Expand Up @@ -505,6 +527,8 @@ case $state in
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'*-c+[Display only the columns specified. Space-separated values. Example: Name Manufacturer]' \
'*--columns=[Display only the columns specified. Space-separated values. Example: Name Manufacturer]' \
'-n[Don'\''t display table header]' \
'--no-header[Don'\''t display table header]' \
'-h[Prints help information]' \
Expand Down
120 changes: 108 additions & 12 deletions completion/orthanc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,21 @@ _orthanc() {
return 0
;;
orthanc__instance__list)
opts=" -n -h -V --no-header --help --version "
opts=" -n -c -h -V --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -297,7 +305,7 @@ _orthanc() {
return 0
;;
orthanc__instance__search)
opts=" -q -n -h -V --query --no-header --help --version "
opts=" -q -n -c -h -V --query --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -312,6 +320,14 @@ _orthanc() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -434,13 +450,21 @@ _orthanc() {
return 0
;;
orthanc__modality__list)
opts=" -n -h -V --no-header --help --version "
opts=" -n -c -h -V --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -618,13 +642,21 @@ _orthanc() {
return 0
;;
orthanc__patient__list)
opts=" -n -h -V --no-header --help --version "
opts=" -n -c -h -V --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand All @@ -633,13 +665,21 @@ _orthanc() {
return 0
;;
orthanc__patient__list__studies)
opts=" -n -h -V --no-header --help --version <ID> "
opts=" -n -c -h -V --no-header --columns --help --version <ID> "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -687,7 +727,7 @@ _orthanc() {
return 0
;;
orthanc__patient__search)
opts=" -q -n -h -V --query --no-header --help --version "
opts=" -q -n -c -h -V --query --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -702,6 +742,14 @@ _orthanc() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -817,13 +865,21 @@ _orthanc() {
return 0
;;
orthanc__series__list)
opts=" -n -h -V --no-header --help --version "
opts=" -n -c -h -V --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand All @@ -832,13 +888,21 @@ _orthanc() {
return 0
;;
orthanc__series__list__instances)
opts=" -n -h -V --no-header --help --version <ID> "
opts=" -n -c -h -V --no-header --columns --help --version <ID> "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -886,7 +950,7 @@ _orthanc() {
return 0
;;
orthanc__series__search)
opts=" -q -n -h -V --query --no-header --help --version "
opts=" -q -n -c -h -V --query --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -901,6 +965,14 @@ _orthanc() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -1016,13 +1088,21 @@ _orthanc() {
return 0
;;
orthanc__study__list)
opts=" -n -h -V --no-header --help --version "
opts=" -n -c -h -V --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand All @@ -1031,13 +1111,21 @@ _orthanc() {
return 0
;;
orthanc__study__list__series)
opts=" -n -h -V --no-header --help --version <ID> "
opts=" -n -c -h -V --no-header --columns --help --version <ID> "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in

--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down Expand Up @@ -1085,7 +1173,7 @@ _orthanc() {
return 0
;;
orthanc__study__search)
opts=" -q -n -h -V --query --no-header --help --version "
opts=" -q -n -c -h -V --query --no-header --columns --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -1100,6 +1188,14 @@ _orthanc() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--columns)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down
Loading

0 comments on commit 045f2c5

Please sign in to comment.