mdk behat -r --tags=@core_completion
-check
------
-
-Perform some checks on the environment to identify possible problems, and attempt to fix them automatically.
-
create
------
mdk css --compile
+doctor
+-----
+
+Perform some checks on the environment to identify possible problems, and attempt to fix them automatically.
+
+
fix
---
// "upall": "update --all". `mdk upall` will execute `mdk update --all`
// "ls": "!ls -al". `mdk ls` will execute `ls -al`
"aliases": {
+ "check": "doctor",
"list": "info -l"
}
}
if [[ "${COMP_CWORD}" == 1 ]]; then
# List the commands and aliases.
# Ignoring these commands on purpose: init
- OPTS="alias backport backup behat check config create css fix info install phpunit plugin purge pull push rebase remove run tracker uninstall update upgrade"
+ OPTS="alias backport backup behat config create css doctor fix info install phpunit plugin purge pull push rebase remove run tracker uninstall update upgrade"
OPTS="$OPTS $($BIN alias list 2> /dev/null | cut -d ':' -f 1)"
else
# List of options according to the command.
OPTS="$OPTS $(_list_instances)"
fi
;;
- check)
- OPTS="--all --branch --cached --directories --remotes --wwwroot"
- ;;
config)
if [[ "${COMP_CWORD}" == 2 ]]; then
OPTS="flatlist list show set"
css)
OPTS="--compile --debug --sheets --theme --watch"
;;
+ doctor)
+ OPTS="--all --branch --cached --directories --remotes --wwwroot"
+ ;;
fix)
if [[ "$PREV" == "-n" || "$PREV" == "--name" ]]; then
OPTS=`$BIN info -ln`
for subargument in sub[1]:
sargs = subargument[0]
skwargs = subargument[1]
+ if skwargs.has_key('silent'):
+ del skwargs['silent']
+ skwargs['help'] = argparse.SUPPRESS
subparser.add_argument(*sargs, **skwargs)
else:
+ if kwargs.has_key('silent'):
+ del kwargs['silent']
+ kwargs['help'] = argparse.SUPPRESS
parser.add_argument(*args, **kwargs)
args = parser.parse_args(sysargs)
'backport',
'backup',
'behat',
- 'check',
'config',
'create',
'css',
+ 'doctor',
'fix',
'info',
'init',
from lib.tools import mkdir
-class CheckCommand(Command):
+class DoctorCommand(Command):
_arguments = [
(
['--all'],
{
'action': 'store_true',
- 'help': 'Enable all the checks, this is the default'
+ 'help': 'Enable all the checks'
}
),
(
'action': 'store_true',
'help': 'Check the branch checked out on your integration instances'
}
-
),
(
['--cached'],
'action': 'store_true',
'help': 'Check the cached repositories'
}
-
),
(
['--directories'],
'action': 'store_true',
'help': 'Check the directories set in the config file'
}
-
+ ),
+ (
+ ['--hi'],
+ {
+ 'action': 'store_true',
+ 'help': 'What you see it totally unrelated to what you get',
+ 'silent': True
+ }
),
(
['--remotes'],
'action': 'store_true',
'help': 'Check the remotes of your instances'
}
-
),
(
['--wwwroot'],
'action': 'store_true',
'help': 'Check the $CFG->wwwroot of your instances'
}
-
)
]
_description = 'Perform several checks on your current installation'
def run(self, args):
- allChecks = True
- if not args.all:
- argsDict = vars(args)
- commands = ['directories', 'cached', 'remotes', 'wwwroot', 'branch']
- for i in commands:
- if argsDict.get(i):
- allChecks = False
- break
+ optionsCount = sum([1 for k, v in vars(args).items() if v != False])
+ if optionsCount == 0 or (optionsCount == 1 and args.fix):
+ self.argumentError('You should probably tell me what symptoms you are experiencing')
+
+ allChecks = False
+ if args.all:
+ allChecks = True
# Check directories
if args.directories or allChecks:
if args.branch or allChecks:
self.branch(args)
+ # Check what you see is what you get
+ if args.hi:
+ self.hi(args)
+
def branch(self, args):
"""Make sure the correct branch is checked out. Only on integration branches."""
print ' Creating %s' % d
mkdir(d, 0777)
+ def hi(self, args):
+ """I wonder what is the purpose of this...
+
+ hint #1: 1341
+ hint #2: dobedobedoh
+ """
+
+ if args.fix:
+ print 'The horse is a noble animal'
+ else:
+ print '<em>Hi</em>'
+
def remotes(self, args):
"""Check that the correct remotes are used"""