 module.exports = cli
 
 ######### - Argument checks and preprocess - ##########
-cli.notEnoughArguments = process.argv.length <= 2
+N_META_ARGUMENTS = 2
+
+cli.notEnoughArguments = process.argv.length <= N_META_ARGUMENTS
+
+# Replace the command argument if it is a second alias defined for convenience
+# (Commander only allows one alias per command)
+replaceSecondAlias = ->
+    SECOND_ALIAS =
+        spd: 'speedup'
+        rm: 'clean'
+        eq: 'equal'
+        an: 'analyze'
+        pf: 'profile'
+        everything: 'all'
+
+    realCommand = SECOND_ALIAS[process.argv[N_META_ARGUMENTS]]
+    process.argv[N_META_ARGUMENTS] = realCommand if realCommand?
+
+checkCommandExists = ->
+    COMMANDS = ['speedup', 's', 'clean', 'C', 'equal', 'e', 'compile', 'c',
+                'profile', 'p']
+
+    # TODO: Replace for logger method call
+    console.log "Invalid command" unless process.argv[N_META_ARGUMENTS] in COMMANDS
 
 ######### - CLI command, options and version definitions- ##########
 cli.version version

        "Forward arguments to the programs"
    .option '-l, --last',
        "Only check equality with the program with greatest lexicographic name"
    .action -> console.log "Equal"

# Compile command
cli

        "Profile with OProfile's opannotate"
    .option '-g, --gprof [:options-string]', "Profile with gprof"
    .option '-n, --no-clean', "Do not clean profiler's intermediate files"
    .action -> console.log "Profile" # TODO: Implement

# TODO: Analyze = Speedup + Profile command
# TODO: All = Check + Speedup + Profile command
