public static String formatUsingExtension(File file, CommandLine cmd) {
		String fileName = file.getPath();
		String extension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
		String nameWithDate = null;
		String code = null;
		if (extension.equals("java") && javaFormatting(cmd)) {
			code = readInFile(fileName);
			Format javaFormatter = new JavaFormat();
			javaFormatter.format(fileName, code);
			if (javaFormatter.isFormatted() && cmd.hasOption("b"))
				nameWithDate = createBackupFile(fileName, code);

		} else if ((extension.equals("groovy")) && groovyFormatting(cmd)) {
			code = readInFile(fileName);
			Format groovyFormatter = new GroovyFormat();
			groovyFormatter.format(fileName, code);
			if (groovyFormatter.isFormatted() && cmd.hasOption("b"))
				nameWithDate = createBackupFile(fileName, code);

		} else {
			//log.info("Sorry, no formatting could be applied to " + fileName);
		}
		return nameWithDate;
	}