updated readme

This commit is contained in:
Alfie King 2024-06-19 16:15:47 +01:00
parent 89af9b499b
commit 53245d19fe
4 changed files with 60 additions and 7 deletions

1
.gitignore vendored
View File

@ -32,3 +32,4 @@
*.out *.out
*.app *.app
builds/

28
.vscode/tasks.json vendored Normal file
View File

@ -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"
}

View File

@ -4,22 +4,46 @@ A simple C++ program that owofies text
## Usage ## Usage
### normal usage:
```bash ```bash
$ ./owo "Hello, world!" $ ./owo "Hello, world!"
Hewwo, wowld! 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 ```bash
$ g++ -o owo owo.cpp $ g++ -o owo owo.cpp
``` ```
## Installation ## Installation
archlinux: ### archlinux:
```bash ```bash
$ git clone `https://git.alfieking.dev/acetheking987/term-owo-cpp.git` $ git clone `https://git.alfieking.dev/acetheking987/term-owo-cpp.git`
$ cd term-owo-cpp $ cd term-owo-cpp
$ makepkg -si $ makepkg -si
``` ```
### 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

View File

@ -34,7 +34,7 @@ int help() {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
string input, inputfile, outputfile; string input, inputfile, outputfile;
bool stdin = false; bool _stdin = false;
if (argc < 2) { if (argc < 2) {
cout << owo("No text provided") << endl << endl; cout << owo("No text provided") << endl << endl;
@ -50,7 +50,7 @@ int main(int argc, char *argv[]) {
outputfile = string(argv[i+1]); outputfile = string(argv[i+1]);
i++; i++;
} else if (string(argv[i]) == "-p") { } else if (string(argv[i]) == "-p") {
stdin = true; _stdin = true;
} else if (string(argv[i]) == "-h") { } else if (string(argv[i]) == "-h") {
return help(); return help();
} else if (i == argc-1) { } 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; cout << owo("Cannot use multiple input methods at once") << endl << endl;
help(); help();
return 1; return 1;
@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
} }
} }
if (stdin) { if (_stdin) {
while (getline(cin, input)) { while (getline(cin, input)) {
if (outputfile != "") { if (outputfile != "") {
*output << owo(input) << endl; *output << owo(input) << endl;