diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-07-27 17:28:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-07-27 17:28:27 +0200 |
commit | 8c1e0035404050376350d5e9b9242f5d39a6b53e (patch) | |
tree | 1aa609d156a4e0c131caf40c2d070d20b304bdbf /tests/file/driver.cxx | |
parent | dca38b27afc25d329fd7a7241095b40e2a1ecae2 (diff) |
Add support for direct file loading with argv_file_scanner
Diffstat (limited to 'tests/file/driver.cxx')
-rw-r--r-- | tests/file/driver.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/file/driver.cxx b/tests/file/driver.cxx index e2dc9d5..82f944c 100644 --- a/tests/file/driver.cxx +++ b/tests/file/driver.cxx @@ -5,7 +5,8 @@ // Test argv_file_scanner. // - +#include <memory> +#include <string> #include <iostream> #include "test.hxx" @@ -17,10 +18,20 @@ main (int argc, char* argv[]) { try { - cli::argv_file_scanner s (argc, argv, "--file"); + string a (argc > 1 ? argv[1] : ""); + + // Special modes. + // + // ---- <file> + // --- <file> + // + unique_ptr<cli::scanner> s ( + a == "----" ? new cli::argv_file_scanner (argv[2], "--file") : + a == "---" ? new cli::argv_file_scanner (argv[2]) : + new cli::argv_file_scanner (argc, argv, "--file")); - while (s.more ()) - cout << s.next () << endl; + while (s->more ()) + cout << s->next () << endl; } catch (const cli::exception& e) { |