Skip to content
Merged
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
21 changes: 20 additions & 1 deletion ocaml/xapi/xapi_host_driver_tool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ module Mock = struct
set -o errexit
set -o pipefail

function deselect {
cat <<EOF
{
"driver": "$1",
"exit": 0
}
EOF
}

function selection {
cat <<EOF
{
Expand All @@ -253,6 +262,7 @@ function selection {
EOF
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange blank line. Is there other intention here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's harmless. I developed the script outside this OCaml file and pasted it back in where this probably was added.

function list() {
cat <<EOF

Expand Down Expand Up @@ -606,9 +616,10 @@ l_flag=false
s_flag=false
n_value=""
v_value=""
d_value=""

# Use getopt to parse command-line options
while getopts "lsn:v:" opt; do
while getopts "lsn:v:d:" opt; do
case "$opt" in
l)
l_flag=true
Expand All @@ -622,6 +633,9 @@ while getopts "lsn:v:" opt; do
v)
v_value="$OPTARG"
;;
d)
d_value="$OPTARG"
;;
\?) # Invalid option
echo "Invalid option: -$OPTARG" >&2 #>&2 redirects error message to stderr
exit 1
Expand Down Expand Up @@ -656,6 +670,11 @@ if $s_flag; then
selection "$n_value" "$v_value"
exit 0
fi

if [ -n "$d_value" ]; then
deselect "$d_value"
exit 0
fi
|}

let install () =
Expand Down
Loading