clipboard support
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -31,5 +31,3 @@
 | 
				
			|||||||
*.exe
 | 
					*.exe
 | 
				
			||||||
*.out
 | 
					*.out
 | 
				
			||||||
*.app
 | 
					*.app
 | 
				
			||||||
 | 
					 | 
				
			||||||
builds/
 | 
					 | 
				
			||||||
							
								
								
									
										28
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							@@ -1,28 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "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"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										6
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					cmake_minimum_required(VERSION 2.8)
 | 
				
			||||||
 | 
					project(owo)
 | 
				
			||||||
 | 
					add_executable(owo owo.cpp)
 | 
				
			||||||
 | 
					add_subdirectory(clip)
 | 
				
			||||||
 | 
					target_link_libraries(owo clip)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								PKGBUILD
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								PKGBUILD
									
									
									
									
									
								
							@@ -12,10 +12,11 @@ md5sums=('SKIP')
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
build() {
 | 
					build() {
 | 
				
			||||||
    cd "$srcdir/term-owo-cpp"
 | 
					    cd "$srcdir/term-owo-cpp"
 | 
				
			||||||
    g++ -o owo owo.cpp
 | 
					    make . -B build
 | 
				
			||||||
 | 
					    cd build && make
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package() {
 | 
					package() {
 | 
				
			||||||
    cd "$srcdir/term-owo-cpp"
 | 
					    cd "$srcdir/term-owo-cpp/build"
 | 
				
			||||||
    install -Dm755 owo "$pkgdir/usr/bin/owo"
 | 
					    install -Dm755 owo "$pkgdir/usr/bin/owo"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										1
									
								
								clip
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								clip
									
									
									
									
									
										Submodule
									
								
							 Submodule clip added at 4e9eeea929
									
								
							
							
								
								
									
										12
									
								
								owo.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								owo.cpp
									
									
									
									
									
								
							@@ -2,6 +2,7 @@
 | 
				
			|||||||
#include <regex>
 | 
					#include <regex>
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <fstream>
 | 
					#include <fstream>
 | 
				
			||||||
 | 
					#include "clip/clip.h"
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
string replacements[6][2] = {
 | 
					string replacements[6][2] = {
 | 
				
			||||||
@@ -29,12 +30,16 @@ int help() {
 | 
				
			|||||||
    cout << "Options:" << endl;
 | 
					    cout << "Options:" << endl;
 | 
				
			||||||
    cout << "  -p  Read from stdin" << endl;
 | 
					    cout << "  -p  Read from stdin" << endl;
 | 
				
			||||||
    cout << "  -h  Show this help message" << endl;
 | 
					    cout << "  -h  Show this help message" << endl;
 | 
				
			||||||
 | 
					    cout << "  -f  Read from file" << endl;
 | 
				
			||||||
 | 
					    cout << "  -o  Write to file" << endl;
 | 
				
			||||||
 | 
					    cout << "  -c  Copy to clipboard" << endl;
 | 
				
			||||||
 | 
					    cout << "  text  Text to convert" << endl;
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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, clipboard = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (argc < 2) {
 | 
					    if (argc < 2) {
 | 
				
			||||||
        cout << owo("No text provided") << endl << endl;
 | 
					        cout << owo("No text provided") << endl << endl;
 | 
				
			||||||
@@ -55,6 +60,8 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
            return help();
 | 
					            return help();
 | 
				
			||||||
        } else if (i == argc-1) {
 | 
					        } else if (i == argc-1) {
 | 
				
			||||||
            input = string(argv[i]);
 | 
					            input = string(argv[i]);
 | 
				
			||||||
 | 
					        } else if (string(argv[i]) == "-c") {
 | 
				
			||||||
 | 
					            clipboard = true;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            cout << owo("Invalid argument: " + string(argv[i])) << endl << endl;
 | 
					            cout << owo("Invalid argument: " + string(argv[i])) << endl << endl;
 | 
				
			||||||
            help();
 | 
					            help();
 | 
				
			||||||
@@ -109,6 +116,9 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
    } else if (input != "") {
 | 
					    } else if (input != "") {
 | 
				
			||||||
        if (outputfile != "") {
 | 
					        if (outputfile != "") {
 | 
				
			||||||
            *output << owo(input) << endl;
 | 
					            *output << owo(input) << endl;
 | 
				
			||||||
 | 
					        } else if (clipboard) {
 | 
				
			||||||
 | 
					            clip::set_text(owo(input));
 | 
				
			||||||
 | 
					            cout << owo("Copied to clipboard") << endl;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            cout << owo(input) << endl;
 | 
					            cout << owo(input) << endl;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user