Refactor deploy command to extract some variables, function arity and chainability