A couple questions about a simple project

Andre Polykanine via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 17 08:05:44 PDT 2015


Hi everyone,
I'm  new to D (I'm learning it by reading the great online book by Ali
Çehreli  -  thank  you  very  much for it, sir!), and, more than that,
programming  is  my hobby, so please bear with me if I'm asking stupid
questions.
I've  made  a  toy  project  which  is  a small command-line XML files
validator:
https://github.com/Oire/dxv/
and I have a couple questions about it:
1.  I'm  using std.getopt but don't know how to make it display a help
message if no options are present at all:
D:\repos\git\dxv\dxv.exe
(nothing   happens   but   I   would  like it to show the help as with
--help switch)
2. As you can see, I check whether the file to validate can be read. I
tried both `try...catch` and `enforce` (current version:
`string  s  =  enforce(cast(string)std.file.read(f),  "Unable  to read
file");`
),  but  this  very  exception  for  some reason can be caught only in
`main()`.
What am I missing?
Thanks!
  

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: @m_elensule; Facebook: menelion
My blog: http://menelion.oire.org/




More information about the Digitalmars-d-learn mailing list