diff --git a/.gitignore b/.gitignore index c37aa89..c30b100 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ !*.cc !*.h !CMakeLists.txt -!config.json \ No newline at end of file +!config.json +!*.py diff --git a/juci/snippet.py b/juci/snippet.py new file mode 100644 index 0000000..0013bd7 --- /dev/null +++ b/juci/snippet.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +#snippet plugin +import juci_to_python_api + +print("From Python: Snippet run") + +snippets = {} +snippets["hoy"] = "hoyvalue" +snippets["for"] = """\ +for(#int i=0; #i<#v.size(); #i++) { + std::cout << v[i] << std::endl; +} +""" +snippets["if"] = """\ +if(#) { + # +} +""" +snippets["ifelse"] = """\ +if(#) { + # +} else { + # +} +""" +snippets["while"] = """\ +while(#) { + # +} +""" +snippets["main"] = """\ +int main(int argc, char *argv[]) { + //Do something +} +""" +snippets["hello"] = """\ +#include + +int main(int argc, char *argv[]) { + std::cout << "Hello, world! << std::endl; +} +""" +def getSnippet(word): + try: + output = snippets[word] + except KeyError: + output = word + return output + +theWord=juci_to_python_api.getWord() +output=getSnippet(theWord) + +print(theWord) +juci_to_python_api.replaceWord(output)