#!/usr/bin/env bash
#clear
#export PS4='\e[90m+${LINENO} in ${#BASH_SOURCE[@]}>${FUNCNAME[0]}:${BASH_SOURCE[@]##*/} \e[0m'
#set -x

#echo "starting: $0 <LOG_LEVEL=$1>"

### new.method

share.status() { # # shows th status of the sharing
  share.samba.status
}

share.samba.status() { # # shows th status of the sharing
  smbstatus
}

share.samba.service() { # <serviceCmd> # shows th status of the sharing
  local serviceCmd="$1"
  if [ -n "$1" ]; then
    shift
  else
    error.log "no serviceCmd specified"
    return 1
  fi  
  systemctl "$serviceCmd" smbd
}

share.parameter.completion.serviceCmd() {
  echo -e "enable \\nstatus \\nrestart \\nstop "
}

share.samba.config.edit() {  # # edit samba config
  edit /etc/samba/smb.conf
  share.samba.service restart
}

share.samba.restart() # #
{
  systemctl restart smbd
  systemctl restart avahi-daemon
  systemctl restart netatalk
}


share.samba.install() { # # install all the necessary packeges for managing RAID and Virtual Partitions
  install samba.support
}

share.usage()
{
  local this=${0##*/}
  echo "You started" 
  echo "$0

  Usage:
  $this: command   Parameter and Description"
  this.help
  echo "
  
  Examples
    $this v
    $this init
    ----------
  "
}

share.start()
{
  #echo "sourcing init"
  source this

  # if [ -z "$1" ]; then
  #   status.discover "$@"
  #   return 0
  # fi

  this.start "$@"
}

share.start "$@"

