Mercurial > jhg
diff cmdline/org/tmatesoft/hg/console/Status.java @ 299:45dc79e545f5
Recognize flag options (options with no arguments) in command line sample apps
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sat, 17 Sep 2011 13:26:52 +0200 |
parents | 23e3ea855097 |
children | 150500515714 |
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Status.java Sat Sep 17 12:24:50 2011 +0200 +++ b/cmdline/org/tmatesoft/hg/console/Status.java Sat Sep 17 13:26:52 2011 +0200 @@ -16,6 +16,7 @@ */ package org.tmatesoft.hg.console; +import static org.tmatesoft.hg.console.Options.asSet; import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; import java.util.ArrayList; @@ -25,6 +26,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import org.tmatesoft.hg.core.HgRepoFacade; import org.tmatesoft.hg.core.HgStatus; @@ -40,7 +42,10 @@ public class Status { public static void main(String[] args) throws Exception { - Options cmdLineOpts = Options.parse(args); + final Set<String> flagOpts = asSet("-A", "-all", "-m", "--modified", "-a", "--added", "-r", "--removed", + "--d", "--deleted", "-u", "--unknown", "-c", "--clean", "-i", "--ignored", + "-n", "--no-status", "-C", "--copies"); + Options cmdLineOpts = Options.parse(args, flagOpts); HgRepoFacade hgRepo = new HgRepoFacade(); if (!hgRepo.init(cmdLineOpts.findRepository())) { System.err.printf("Can't find repository in: %s\n", hgRepo.getRepository().getLocation());