package com.nilhcem.md2html;

import java.awt.EventQueue;
import java.io.FileNotFoundException;
import javax.swing.UIManager;
import com.nilhcem.md2html.console.ArgsParser;
import com.nilhcem.md2html.console.ConsoleMode;
import com.nilhcem.md2html.console.DisplayUsageException;
import com.nilhcem.md2html.gui.MainFrame;

/**
 * Entry point of the application.
 * 
 * @author Nilhcem
 * @since 1.0
 */
public final class App {
	private App() {}

	/**
	 * Launches the program in command line or using a GUI.
	 * <p>
	 * If the program is launched in GUI mode, sets some properties for a better look and feel integration.
	 * </p>
	 * 
	 * @param args a list of arguments.
	 */
	public static void main(String[] args) {
		try {
			ArgsParser params = new ArgsParser();
			params.checkArgs(args);

			if (params.isConsoleMode()) { // Command line
				new ConsoleMode().process(params);
			} else { // GUI
				EventQueue.invokeLater(new Runnable() {
					@Override
					public void run() {
						System.setProperty("apple.laf.useScreenMenuBar", "true");
						System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Markdown editor");
						UIManager.put("swing.boldMetal", Boolean.FALSE);
						try {
							UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
						} catch (Exception e) {
							System.err.println("error: " + e.getMessage());
							e.printStackTrace();
						}
						new MainFrame();
					}
				});
			}
		} catch (DisplayUsageException e) {
			System.err.println(e.getMessage());
		} catch (FileNotFoundException e) {
			System.err.println(String.format("File not found: %s", e.getMessage()));
		}
	}
}

@@ -749,16 +749,528 @@
 %09try %7B%0D%0A
+%09%09%09int idxDir = -1;%0D%0A%09%09%09for(int i=0; i%3Cargs.length; i++)%7B%0D%0A%09%09%09%09if(args%5Bi%5D.equals(%22-d%22))%7B%0D%0A%09%09%09%09%09idxDir = i+1;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%09//System.out.println(args%5Bi%5D);%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09if(idxDir%3E0)%7B%0D%0A%09%09%09%09try %7B%0D%0A%09%09%09%09%09File dir = new File(args%5BidxDir%5D);%0D%0A%09%09%09%09%09//System.out.println(dir.getAbsolutePath());%0D%0A%09%09%09%09%09if(!dir.isDirectory())%7B%0D%0A%09%09%09%09%09%09System.out.println(args%5BidxDir%5D + %22 must be dir.%22);%0D%0A%09%09%09%09%09%7Delse%7B%0D%0A%09%09%09%09%09%09DoDir.doDir(dir);%0D%0A%09%09%09%09%09%7D%0D%0A%09%09%09%09%7D catch (Exception e) %7B%0D%0A%09%09%09%09%09e.printStackTrace();%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%09return;%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09%0D%0A
 %09%09%09ArgsP

Update App.java