Add roscat to display file contents as stdout

This commit is contained in:
Kentaro Wada 2016-03-04 19:46:52 +09:00
parent 9b9ea3729e
commit 3a0d4d1edb
4 changed files with 36 additions and 1 deletions

View File

@ -282,6 +282,23 @@ function roscp {
cp ${arg} ${3} cp ${arg} ${3}
} }
function roscat {
local arg
if [[ $1 = "--help" ]] || [[ $# -ne 2 ]]; then
echo -e "usage: roscat [package] [file]\n\nDisplay a file content within a package."
[[ $1 = "--help" ]] && return 0 || return 1
fi
_roscmd ${1} ${2}
[ $? -eq 1 ] && return 1
if [[ -n ${arg} ]]; then
if [[ -z $CATTER ]]; then
cat ${arg}
else
$CATTER ${arg}
fi
fi
}
function rosawesome { function rosawesome {
alias megamaid='rosbag record' alias megamaid='rosbag record'
alias suck2blow='rosbag play' alias suck2blow='rosbag play'
@ -949,6 +966,7 @@ complete -F "_roscomplete_rosclean" "rosclean"
complete -F "_roscomplete_exe" "rosrun" complete -F "_roscomplete_exe" "rosrun"
complete -F "_roscomplete_file" "rosed" complete -F "_roscomplete_file" "rosed"
complete -F "_roscomplete_file" "roscp" complete -F "_roscomplete_file" "roscp"
complete -F "_roscomplete_file" "roscat"
complete -F "_roscomplete_launch" -o filenames "roslaunch" complete -F "_roscomplete_launch" -o filenames "roslaunch"
complete -F "_roscomplete_test" -o filenames "rostest" complete -F "_roscomplete_test" -o filenames "rostest"
complete -F "_roscomplete_rospack" "rospack" complete -F "_roscomplete_rospack" "rospack"

View File

@ -1,3 +1,4 @@
#alias roscat 'echo "unimplemented"'
function _rossed function _rossed
if test (uname) = "Darwin" -o (uname) = "FreeBSD" if test (uname) = "Darwin" -o (uname) = "FreeBSD"

View File

@ -4,6 +4,7 @@ alias rosls 'ls `rospack find \!*`'
#alias rosd 'echo "unimplemented"' #alias rosd 'echo "unimplemented"'
#alias rospd 'echo "unimplemented"' #alias rospd 'echo "unimplemented"'
#alias rosed 'echo "unimplemented"' #alias rosed 'echo "unimplemented"'
#alias roscat 'echo "unimplemented"'
#alias roscmd 'echo "unimplemented"' #alias roscmd 'echo "unimplemented"'
#alias roscp 'echo "unimplemented"' #alias roscp 'echo "unimplemented"'

View File

@ -263,6 +263,21 @@ function roscp {
cp ${arg} ${3} cp ${arg} ${3}
} }
function roscat {
local arg
if [[ $1 = "--help" ]] | [[ $# -ne 2 ]]; then
echo -e "usage: roscat [package] [file]\n\nDisplay a file content within a package."
[[ $1 = "--help" ]] && return 0 || return 1
fi
_roscmd ${1} ${2}
[ $? -eq 1 ] && return 1
if [[ -z $CATTER ]]; then
cat ${arg}
else
$CATTER ${arg}
fi
}
function _roscomplete { function _roscomplete {
local arg opts stack_opts local arg opts stack_opts
reply=() reply=()
@ -730,7 +745,7 @@ compctl -K "_roscomplete_sub_dir" -S / "roscd" "rospd" "rosls"
compctl -K "_roscomplete_rosmake" "rosmake" compctl -K "_roscomplete_rosmake" "rosmake"
compctl -x 'p[1]' -k "(check purge)" -- "rosclean" compctl -x 'p[1]' -k "(check purge)" -- "rosclean"
compctl -f -x 'p[1]' -K "_roscomplete" - 'p[2]' -K _roscomplete_file -- "rosed" "roscp" compctl -f -x 'p[1]' -K "_roscomplete" - 'p[2]' -K _roscomplete_file -- "rosed" "roscp" "roscat"
compctl -f -x 'S[-]' -k '(--debug --prefix)' - 'c[-1,--prefix][-1,-p]' -h '' - 'p[1],c[-1,-d],c[-1,--debug],c[-2,-p],c[-2,--prefix]' -K "_roscomplete" - 'p[2],c[-2,-d],c[-2,--debug],c[-3,-p],c[-3,--prefix]' -K _roscomplete_exe -- "rosrun" compctl -f -x 'S[-]' -k '(--debug --prefix)' - 'c[-1,--prefix][-1,-p]' -h '' - 'p[1],c[-1,-d],c[-1,--debug],c[-2,-p],c[-2,--prefix]' -K "_roscomplete" - 'p[2],c[-2,-d],c[-2,--debug],c[-3,-p],c[-3,--prefix]' -K _roscomplete_exe -- "rosrun"
compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--files --args --nodes --find-node --child --local --screen --server_uri --run_id --wait --port --core --pid --dump-params)" -- "roslaunch" compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--files --args --nodes --find-node --child --local --screen --server_uri --run_id --wait --port --core --pid --dump-params)" -- "roslaunch"
compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--bare --bare-limit --bare-name --pkgdir --package)" -- "rostest" compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--bare --bare-limit --bare-name --pkgdir --package)" -- "rostest"