Commits

Audrius Kažukauskas  committed 644fc17

Split ls command into lst and lsc.

This makes it look consistent with other pairs of commands (maket/makec and
rmt/rmc).

  • Participants
  • Parent commits dc57eb6

Comments (0)

Files changed (5)

File usr/libexec/lxc-slack/info

   [ "$LIST_ALL" != "yes" -a -z "$CONTAINER_NAME" ] && cmd_usage
 
   if [ "$LIST_ALL" = "yes" ]; then
-    for NAME in $( ${ROOT}/${MAIN} ls c ); do
+    for NAME in $( ${ROOT}/${MAIN} lsc ); do
       lxc-info -n ${NAME}
     done
   else

File usr/libexec/lxc-slack/ls

-#!/bin/sh
-
-cmd_usage() {   # {{{
-  cat >&2 <<EOF
-List templates or containers.
-
-Usage: $MAIN $CMD <t|c>
-
-Parameters:
-
-  t   templates
-  c   containers
-
-EOF
-
-  exit 1
-}   # }}}
-
-# Initialize command.
-cmd_init() {   # {{{
-  CMD_OPT=":"
-
-  return 0
-}   # }}}
-
-# Process command options.
-cmd_opt() {    # {{{
-  local opt="$1" optind="$2" optarg="$3"
-  case "$opt" in
-    \?)
-      echo "Options not accepted." >&2
-      exit 1
-      ;;
-  esac
-
-  return 0
-}   # }}}
-
-# Process command parameters.
-cmd_param() {    # {{{
-  if [ -z "$LIST_TARGET" ]; then
-    [ "$1" = "t" ] && LIST_TARGET="t"
-    [ "$1" = "c" ] && LIST_TARGET="c"
-  fi
-
-  if [ -z "$LIST_TARGET" ]; then
-    echo "Invalid target, must be t (templates) or c (containers)." >&2
-    exit 1
-  fi
-
-  return 0
-}   # }}}
-
-list_templates() {    # {{{
-  if [ -d "${BASE_PATH}/templates" ]; then
-    find ${BASE_PATH}/templates \
-      -type d -maxdepth 1 -mindepth 1 -exec basename {} \;
-  fi
-  return 0
-}   # }}}
-
-list_containers() {   # {{{
-  if [ -d "${BASE_PATH}/containers" ]; then
-    find ${BASE_PATH}/containers \
-      -type d -maxdepth 1 -mindepth 1 -exec basename {} \;
-  fi
-  return 0
-}   # }}}
-
-cmd_main() {   # {{{
-  [ -z "$LIST_TARGET" ] && cmd_usage
-
-  [ "$LIST_TARGET" = "t" ] && list_templates
-  [ "$LIST_TARGET" = "c" ] && list_containers
-
-  return 0
-}   # }}}

File usr/libexec/lxc-slack/lsc

+#!/bin/sh
+
+cmd_usage() {   # {{{
+  cat >&2 <<EOF
+Display the list of containers.
+
+Usage: $MAIN $CMD
+
+EOF
+
+  exit 1
+}   # }}}
+
+# Initialize command.
+cmd_init() {   # {{{
+  CMD_OPT=":h"
+
+  return 0
+}   # }}}
+
+# Process command options.
+cmd_opt() {    # {{{
+  local opt="$1" optind="$2" optarg="$3"
+  case "$opt" in
+    h)
+      cmd_usage
+      ;;
+    \?)
+      echo "Invalid option: -$optarg" >&2
+      exit 1
+      ;;
+    :)
+      echo "Option -$optarg requires an argument." >&2
+      exit 1
+      ;;
+  esac
+
+  return 0
+}   # }}}
+
+# Process command parameters.
+cmd_param() {    # {{{
+  return 0
+}   # }}}
+
+cmd_main() {   # {{{
+  if [ -d "${BASE_PATH}/containers" ]; then
+    find ${BASE_PATH}/containers \
+      -type d -maxdepth 1 -mindepth 1 -exec basename {} \;
+  fi
+
+  return 0
+}   # }}}

File usr/libexec/lxc-slack/lst

+#!/bin/sh
+
+cmd_usage() {   # {{{
+  cat >&2 <<EOF
+Display the list of templates.
+
+Usage: $MAIN $CMD
+
+EOF
+
+  exit 1
+}   # }}}
+
+# Initialize command.
+cmd_init() {   # {{{
+  CMD_OPT=":h"
+
+  return 0
+}   # }}}
+
+# Process command options.
+cmd_opt() {    # {{{
+  local opt="$1" optind="$2" optarg="$3"
+  case "$opt" in
+    h)
+      cmd_usage
+      ;;
+    \?)
+      echo "Invalid option: -$optarg" >&2
+      exit 1
+      ;;
+    :)
+      echo "Option -$optarg requires an argument." >&2
+      exit 1
+      ;;
+  esac
+
+  return 0
+}   # }}}
+
+# Process command parameters.
+cmd_param() {    # {{{
+  return 0
+}   # }}}
+
+cmd_main() {   # {{{
+  if [ -d "${BASE_PATH}/templates" ]; then
+    find ${BASE_PATH}/templates \
+      -type d -maxdepth 1 -mindepth 1 -exec basename {} \;
+  fi
+
+  return 0
+}   # }}}

File usr/sbin/lxc-slack

   rmt     remove a template
   rmc     remove a container
 
-  ls      list all templates or containers
+  lst     list all templates
+  lsc     list all containers
   info    display the state of container
 
 Run "$MAIN COMMAND" to get help for COMMAND.