From 53245d19fee96ad08931c912c3ddc36e3c807ace Mon Sep 17 00:00:00 2001 From: Alfie King Date: Wed, 19 Jun 2024 16:15:47 +0100 Subject: [PATCH] updated readme --- .gitignore | 1 + .vscode/tasks.json | 28 ++++++++++++++++++++++++++++ README.md | 30 +++++++++++++++++++++++++++--- owo.cpp | 8 ++++---- 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index e257658..10e81be 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ *.out *.app +builds/ \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..05054c5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/README.md b/README.md index 049901e..b91dff1 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,46 @@ A simple C++ program that owofies text ## Usage +### normal usage: ```bash $ ./owo "Hello, world!" Hewwo, wowld! ``` -## Building +### from pipe / stdin: +```bash +$ echo "Hello, world!" | ./owo -p +Hewwo, wowld! +``` +### from file: +```bash +$ ./owo -f file.txt +Hewwo, wowld! +``` + +### to file: +```bash +$ ./owo -o output.txt "Hello, world!" +``` + +## Building +to build the program, run the following command (note that you need g++ installed): ```bash $ g++ -o owo owo.cpp ``` ## Installation -archlinux: +### archlinux: ```bash $ git clone `https://git.alfieking.dev/acetheking987/term-owo-cpp.git` $ cd term-owo-cpp $ makepkg -si -``` \ No newline at end of file +``` + +### other distros: +download the binary from the releases page or build from source + +## License +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details \ No newline at end of file diff --git a/owo.cpp b/owo.cpp index 352a4dc..bcdac8d 100644 --- a/owo.cpp +++ b/owo.cpp @@ -34,7 +34,7 @@ int help() { int main(int argc, char *argv[]) { string input, inputfile, outputfile; - bool stdin = false; + bool _stdin = false; if (argc < 2) { cout << owo("No text provided") << endl << endl; @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) { outputfile = string(argv[i+1]); i++; } else if (string(argv[i]) == "-p") { - stdin = true; + _stdin = true; } else if (string(argv[i]) == "-h") { return help(); } else if (i == argc-1) { @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) { } } - if (stdin && inputfile != "" || stdin && input != "" || inputfile != "" && input != "") { + if (_stdin && inputfile != "" || _stdin && input != "" || inputfile != "" && input != "") { cout << owo("Cannot use multiple input methods at once") << endl << endl; help(); return 1; @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) { } } - if (stdin) { + if (_stdin) { while (getline(cin, input)) { if (outputfile != "") { *output << owo(input) << endl;