[xoreos-git] [xoreos/xoreos-tools] d06577: COMMON: Add a new CLI class

GitHub noreply at github.com
Sun Apr 30 15:57:49 CEST 2017


  Branch: refs/heads/coverity_scan
  Home:   https://github.com/xoreos/xoreos-tools
  Commit: d065776697d4ed29f0f5fd1dbe64a6847324df5a
      https://github.com/xoreos/xoreos-tools/commit/d065776697d4ed29f0f5fd1dbe64a6847324df5a
  Author: Matthias Gatto <usi.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    A src/common/cli.cpp
    A src/common/cli.h
    M src/common/rules.mk
    M src/tlk2xml.cpp

  Log Message:
  -----------
  COMMON: Add a new CLI class

The goal of this new class is to simplifie the arguments parsing,
I've take inspiration from glib Commandline option parser:
https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html,
exept that with glib you need to specifie with a flag the type of each options,
here options type are automatically determine when adding an option
with parser.addOption.

Basically most of the job is made in the parser contructor, here you can
set the name of the program, summary, and arguments that are not options.

Option like "--nwm" are set with addOption function.
"--help" is automatically generated with arguments you've use in
addOption and in the contructor, "--version" is generated too, and
call Version::printVersion.


  Commit: 2fd6d590181ab65dbc46db01b42581285251628d
      https://github.com/xoreos/xoreos-tools/commit/2fd6d590181ab65dbc46db01b42581285251628d
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/tlk2xml.cpp

  Log Message:
  -----------
  TLK2XML: Use CLI class


  Commit: 422ade2815325f86362415e1d275ac76067ad40e
      https://github.com/xoreos/xoreos-tools/commit/422ade2815325f86362415e1d275ac76067ad40e
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/gff2xml.cpp

  Log Message:
  -----------
  GFF2XML: Use CLI class


  Commit: 0f673aa5b1b31a02b1b1363aa3266b0b3288ba7b
      https://github.com/xoreos/xoreos-tools/commit/0f673aa5b1b31a02b1b1363aa3266b0b3288ba7b
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/cbgt2tga.cpp

  Log Message:
  -----------
  CBGT2TGA: Use CLI class


  Commit: 849911d803a5e54cb2840a28d8960453823fa20e
      https://github.com/xoreos/xoreos-tools/commit/849911d803a5e54cb2840a28d8960453823fa20e
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/cdpth2tga.cpp

  Log Message:
  -----------
  CDPTH2TGA: Use CLI class


  Commit: a567d4d36e24011db59b532dfe9bc31df8f91858
      https://github.com/xoreos/xoreos-tools/commit/a567d4d36e24011db59b532dfe9bc31df8f91858
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/convert2da.cpp

  Log Message:
  -----------
  CONVERT2DA: Use CLI class


  Commit: d907279ba000b3e738381cd0cd44b9b619348002
      https://github.com/xoreos/xoreos-tools/commit/d907279ba000b3e738381cd0cd44b9b619348002
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/desmall.cpp

  Log Message:
  -----------
  DESMALL: Use CLI class


  Commit: e0942525d25c71854960d8b87c73104945ae9e88
      https://github.com/xoreos/xoreos-tools/commit/e0942525d25c71854960d8b87c73104945ae9e88
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/fixpremiumgff.cpp

  Log Message:
  -----------
  FIXPREMIUMGFF: Use CLI class


  Commit: 746016dd0a568b5978e24d2f0ea2e6cef1063c6d
      https://github.com/xoreos/xoreos-tools/commit/746016dd0a568b5978e24d2f0ea2e6cef1063c6d
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/nbfs2tga.cpp

  Log Message:
  -----------
  NBFS2TGA: Use CLI class


  Commit: e47e26e186063dddee41e697a5711b4515637206
      https://github.com/xoreos/xoreos-tools/commit/e47e26e186063dddee41e697a5711b4515637206
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/ncgr2tga.cpp

  Log Message:
  -----------
  NCGR2TGA: Use CLI class


  Commit: 93f935ed9d5370113a6e9d26b540bb1575757d23
      https://github.com/xoreos/xoreos-tools/commit/93f935ed9d5370113a6e9d26b540bb1575757d23
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/ssf2xml.cpp

  Log Message:
  -----------
  SSF2XML: Use CLI class


  Commit: f7e8fb2e4266236c1a4b317c6ca19648bc824eb4
      https://github.com/xoreos/xoreos-tools/commit/f7e8fb2e4266236c1a4b317c6ca19648bc824eb4
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/ncsdis.cpp

  Log Message:
  -----------
  NCSDIS: Use CLI class


  Commit: d51ce211417f16d68075732eea006f204846cac9
      https://github.com/xoreos/xoreos-tools/commit/d51ce211417f16d68075732eea006f204846cac9
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/unrim.cpp

  Log Message:
  -----------
  UNRIM: Use CLI class


  Commit: 53594443ea1723f8aa4e94c85d1612c842e53d25
      https://github.com/xoreos/xoreos-tools/commit/53594443ea1723f8aa4e94c85d1612c842e53d25
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/unherf.cpp

  Log Message:
  -----------
  UNHERF: Use CLI class


  Commit: da58ac8ae5da020a72f2a1529ea90b6af766387f
      https://github.com/xoreos/xoreos-tools/commit/da58ac8ae5da020a72f2a1529ea90b6af766387f
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/unerf.cpp

  Log Message:
  -----------
  UNERF: Use CLI class


  Commit: a4112a2e8ed5fe0751c55e808de14bb4c13fedfc
      https://github.com/xoreos/xoreos-tools/commit/a4112a2e8ed5fe0751c55e808de14bb4c13fedfc
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/unkeybif.cpp

  Log Message:
  -----------
  UNKEYBIF: Use CLI class


  Commit: c4189d108958985a65f3eb59b2632ace85840130
      https://github.com/xoreos/xoreos-tools/commit/c4189d108958985a65f3eb59b2632ace85840130
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/unnds.cpp

  Log Message:
  -----------
  UNNDS: Use CLI class


  Commit: ec0762683b7b33379ab9a6c8909cc2771fdc708e
      https://github.com/xoreos/xoreos-tools/commit/ec0762683b7b33379ab9a6c8909cc2771fdc708e
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/unnsbtx.cpp

  Log Message:
  -----------
  UNNSBTX: Use CLI class


  Commit: 23bfce9d0502936c1e802bf7e5fab4b9494e23c0
      https://github.com/xoreos/xoreos-tools/commit/23bfce9d0502936c1e802bf7e5fab4b9494e23c0
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/xml2ssf.cpp

  Log Message:
  -----------
  XML2SSF: Use CLI class

In this file, "Usage: xml2ssf [<options>] [<input file>] <output file>"
change to
"Usage: ./bin/xml2ssf [<options>] <[input file] <output file>>".

I had to use an array of stings to get input file and output file,
this is because input file is the optinal argument and is before ouput file,
I would be harder to handle this case automatically in cli.h, as I would need to
check if there is non optinal argument after the optinal one.

I could do that, but as this file is the only one that need that, I don't think
it worth the effort so I just get all arguments in a vector,
and let some bytes of the old parser do what's left of the job


  Commit: fdffc7f0f74be440f63a28f02cbda90b4055444e
      https://github.com/xoreos/xoreos-tools/commit/fdffc7f0f74be440f63a28f02cbda90b4055444e
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/xoreostex2tga.cpp

  Log Message:
  -----------
  XOREOSTEX2TGA: Use CLI class


  Commit: 519f2f6219ab803c60c26ea77163409affb85ff3
      https://github.com/xoreos/xoreos-tools/commit/519f2f6219ab803c60c26ea77163409affb85ff3
  Author: Matthias Gatto <uso.cosmo.ray at gmail.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M src/xml2tlk.cpp

  Log Message:
  -----------
  XML2TLK: Use CLI class

Signed-off-by: Matthias Gatto <uso.cosmo.ray at gmail.com>


  Commit: 1b6d66a9f6d4c55925dfaa5267ba68e27683bc38
      https://github.com/xoreos/xoreos-tools/commit/1b6d66a9f6d4c55925dfaa5267ba68e27683bc38
  Author: Sven Hesse <drmccoy at drmccoy.de>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M AUTHORS

  Log Message:
  -----------
  DOCS: Add Matthias Gatto to the contributors list


Compare: https://github.com/xoreos/xoreos-tools/compare/f0dc3476727c...1b6d66a9f6d4


More information about the xoreos-git mailing list