Skip to content

Commit

Permalink
fixing bug with set-session in bash and zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Oct 4, 2020
1 parent a29508f commit 50722c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

#### Bugfixes

* Fixed bug when using `set-session "my filter"` in bash and zsh profiles which resulted in an "unknown flag" error

## Released

### v1.5.0
Expand Down
9 changes: 4 additions & 5 deletions tools/bash/c8y.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
# set-session
#
set-session () {
args=""
if [ $# -gt 0 ]; then
args="--sessionFilter \"$@\""
resp=$( c8y sessions list --sessionFilter "$1 $2 $3 $4 $5" )
else
resp=$( c8y sessions list )
fi
echo "c8y sessions list $args"
resp=$( c8y sessions list $args)

if [ $? -ne 0 ]; then
echo "Set session aborted"
return
fi

export C8Y_SESSION=$( c8y sessions list $args)
export C8Y_SESSION=$resp

# Export session as individual settings
# to support other 3rd party applicatsion (i.e. java c8y sdk apps)
Expand Down
7 changes: 3 additions & 4 deletions tools/bash/c8y.profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ fi
# set-session
#
set-session () {
args=""
if [ $# -gt 0 ]; then
args="--sessionFilter \"$@\""
resp=$( c8y sessions list --sessionFilter "$1 $2 $3 $4 $5" )
else
resp=$( c8y sessions list )
fi
echo "c8y sessions list $args"
resp=$( c8y sessions list $args)

if [ $? -ne 0 ]; then
echo "Set session aborted"
Expand Down

0 comments on commit 50722c0

Please sign in to comment.