diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-11-01 21:32:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-11-01 21:33:37 +0300 |
commit | 2494c745761e17d5ad92dbbed4de8d4124db39fd (patch) | |
tree | e56570a5d6928627688a39c3e0f80950978700c0 /src | |
parent | b71b331bd14b337cb84c30bc36ba62428f1d261c (diff) | |
download | plus-2494c745761e17d5ad92dbbed4de8d4124db39fd.tar.gz plus-2494c745761e17d5ad92dbbed4de8d4124db39fd.tar.bz2 plus-2494c745761e17d5ad92dbbed4de8d4124db39fd.tar.xz plus-2494c745761e17d5ad92dbbed4de8d4124db39fd.zip |
in dyecmd add support for 2 and 3 parameters.
Example:
./dyecmd cottonshirt.png W:#a4b2b2,ffffff test.png
./dyecmd "cottonshirt.png|W:#a4b2b2,ffffff" test2.png
Diffstat (limited to 'src')
-rw-r--r-- | src/dyetool/dyemain.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp index 3199a5c49..fe7ad0588 100644 --- a/src/dyetool/dyemain.cpp +++ b/src/dyetool/dyemain.cpp @@ -46,13 +46,14 @@ int serverVersion = 0; static void printHelp() { - std::cout << _("dyecmd srcfile dyestring dstfile") - << std::endl << std::endl; + std::cout << _("dyecmd srcfile dyestring dstfile") << std::endl; + std::cout << _("or") << std::endl; + std::cout << _("dyecmd srcdyestring dstfile") << std::endl; } int main(int argc, char **argv) { - if (argc != 4) + if (argc < 3 || argc > 4) printHelp(); logger = new Logger; @@ -73,13 +74,24 @@ int main(int argc, char **argv) resman->setWriteDir("."); resman->addToSearchPath(".", false); resman->addToSearchPath("/", false); - Image *image = resman->getImage(std::string( - argv[1]).append("|").append(argv[2])); + std::string src = argv[1]; + std::string dst; + if (argc == 4) + { + src.append("|").append(argv[2]); + dst = argv[3]; + } + else + { + dst = argv[2]; + } + + Image *image = resman->getImage(src); if (!image) { printf("Error loading image\n"); return 1; } - ImageWriter::writePNG(image->getSDLSurface(), argv[3]); + ImageWriter::writePNG(image->getSDLSurface(), dst); return 0; } |