-S --host \
-P --port \
-h --help --version \
- --var_dir \
+ --var-dir --var_dir \
+ --generate-config \
-d --daemon"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
-c|--config)
_filedir
if [ -z $XDG_DATA_HOME ]; then
- local confnames=$(for x in $(ls -1 $HOME/.config/mpd_sima/*.cfg 2>/dev/null) ; do echo "${x##*//}"; done)
+ local confnames=$(for x in $(ls -1 $HOME/.config/mpd_sima/*.cfg $PWD/*.cfg 2>/dev/null) ; do echo "${x##*//}"; done)
else
- local confnames=$(for x in $(ls -1 $HOME/.config/mpd_sima/*.cfg $XDG_DATA_HOME/mpd_sima/*.cfg 2>/dev/null) ; do echo "${x##*//}"; done)
+ local confnames=$(for x in $(ls -1 $HOME/.config/mpd_sima/*.cfg $XDG_DATA_HOME/mpd_sima/*.cfg $PWD/*.cfg 2>/dev/null) ; do echo "${x##*//}"; done)
fi
- COMPREPLY+=( $(compgen -W "${confnames}") )
+ COMPREPLY+=( $(compgen -W "${confnames}" -- ${cur} ) )
return 0
;;
--host|-S)
[crop]
## CONSUME
# type: integer
-# default: unset, not cropping playlist
+# default: 10
# description: How many played tracks to keep in the playlist.
# Allow to maintain a fixed length playlist.
-# Leave commented to keep all tracks
#consume = 10
[random]
def start(sopt, restart=False):
"""starts application
"""
- # set logger
- verbosity = sopt.options.get('verbosity', 'warning')
# loads configuration
config = ConfMan(sopt.options).config
+ # set logger
+ logger = logging.getLogger('sima')
logfile = config.get('log', 'logfile', fallback=None)
verbosity = config.get('log', 'verbosity')
set_logger(verbosity, logfile)
- logger = logging.getLogger('sima')
logger.debug('Command line say: {0}'.format(sopt.options))
# Create Database
db_file = config.get('sima', 'db_file')
logger:
level: in debug, info, warning,…
logfile: file to log to
-
"""
name = 'sima'
if environ.get('TRACE', False):
configuration. You can put other options with this one to get them in\
the generated configuration.'},
{
- 'sw':['--var_dir'],
+ 'sw':['--var-dir', '--var_dir'],
'dest': 'var_dir',
'action': Wdir,
'help': 'Directory to store var content (ie. database, cache)'},
#'help': 'Queue mode in [track, top, album]',
'help': SUPPRESS, },
{
- 'sw':['--purge_history'],
+ 'sw':['--purge-history'],
'action': 'store_true',
'dest': 'do_purge_history',
'help': SUPPRESS},
]
-class StartOpt(object):
+class StartOpt:
"""Command line management.
"""