Mercurial > jhg
comparison cmdline/org/tmatesoft/hg/console/Cat.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 | d5268ca7715b |
children |
comparison
equal
deleted
inserted
replaced
298:aac0c3fab6ce | 299:45dc79e545f5 |
---|---|
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 19 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
20 | 20 |
21 import java.io.IOException; | 21 import java.io.IOException; |
22 import java.io.OutputStream; | 22 import java.io.OutputStream; |
23 import java.nio.ByteBuffer; | 23 import java.nio.ByteBuffer; |
24 import java.util.Collections; | |
24 | 25 |
25 import org.tmatesoft.hg.repo.HgDataFile; | 26 import org.tmatesoft.hg.repo.HgDataFile; |
26 import org.tmatesoft.hg.repo.HgRepository; | 27 import org.tmatesoft.hg.repo.HgRepository; |
27 import org.tmatesoft.hg.util.ByteChannel; | 28 import org.tmatesoft.hg.util.ByteChannel; |
28 | 29 |
32 * @author TMate Software Ltd. | 33 * @author TMate Software Ltd. |
33 */ | 34 */ |
34 public class Cat { | 35 public class Cat { |
35 | 36 |
36 public static void main(String[] args) throws Exception { | 37 public static void main(String[] args) throws Exception { |
37 Options cmdLineOpts = Options.parse(args); | 38 Options cmdLineOpts = Options.parse(args, Collections.<String>emptySet()); |
38 HgRepository hgRepo = cmdLineOpts.findRepository(); | 39 HgRepository hgRepo = cmdLineOpts.findRepository(); |
39 if (hgRepo.isInvalid()) { | 40 if (hgRepo.isInvalid()) { |
40 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); | 41 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); |
41 return; | 42 return; |
42 } | 43 } |