From 19b9efdf6c71e8fb3407ab376d442ae60bfbb33f Mon Sep 17 00:00:00 2001 From: gabriel Date: Sat, 19 Oct 2019 20:24:36 -0300 Subject: [PATCH 1/5] Ideas --- rigatonibot/cli.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 rigatonibot/cli.py diff --git a/rigatonibot/cli.py b/rigatonibot/cli.py new file mode 100644 index 0000000..0ee4f63 --- /dev/null +++ b/rigatonibot/cli.py @@ -0,0 +1,19 @@ +# Ta esse eh o unico arquivo que soh eu tenho por enquanto: +""" +Ideias: +1- fazer primeiro via cli, + python rigatoni.py .py --> nao precisa ser py, mas acho que comece assim + --> a nao ser que converter pra txt sempre funcione + a) devolve o link criado no paste + b) abre direto no navegador o negocio criado + +2- depois dar um jeito de fazer isso virar uma ferramenta sh + rigatoni .py + +3- depois (ou antes) ja fazer um bot de telegrao + (eh bom pq dai a galera nao tem que instalar essa pomba no pc) + +4- oferecer outras ferramentas de paste + rigatoni {paste, gist} + (ei, nao precisa ser .py!) +""" \ No newline at end of file From 5bb232d3882646686d0810fffdc1eaf8666fb2ef Mon Sep 17 00:00:00 2001 From: gabriel Date: Sun, 27 Oct 2019 11:28:25 -0300 Subject: [PATCH 2/5] cli_stuff done --- rigatonibot/cli.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rigatonibot/cli.py b/rigatonibot/cli.py index 0ee4f63..a6bf885 100644 --- a/rigatonibot/cli.py +++ b/rigatonibot/cli.py @@ -1,3 +1,22 @@ +import click +from pathlib import Path +import requests + +@click.command() +@click.argument('filename', type=click.Path(exists=True, readable=True), nargs=1) +def main(filename): + path = Path(filename).as_posix() + + with open(path, 'r') as file: + data = file.read() + web_address = requests.post('http://paste.rs', data=data) + + print(web_address.text) + +if __name__ == '__main__': + main() + + # Ta esse eh o unico arquivo que soh eu tenho por enquanto: """ Ideias: From 70b0659bc19d8b4551f1569242df370b841d1661 Mon Sep 17 00:00:00 2001 From: gabriel Date: Sun, 27 Oct 2019 11:31:47 -0300 Subject: [PATCH 3/5] updated setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 52835bc..dd1b734 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,8 @@ name='rigatonibot', version='1.0.0', packages=find_packages(), - install_requires=['python-telegram-bot', 'requests'], + install_requires=['python-telegram-bot', 'requests', 'click', + 'pathlib'], entry_points=''' [console_scripts] rigatonibot=rigatonibot.__main__:main From 82e8ea5198764679d88649569daca4276e587963 Mon Sep 17 00:00:00 2001 From: gabriel Date: Sun, 27 Oct 2019 11:36:24 -0300 Subject: [PATCH 4/5] added docs --- rigatonibot/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rigatonibot/cli.py b/rigatonibot/cli.py index a6bf885..caa3261 100644 --- a/rigatonibot/cli.py +++ b/rigatonibot/cli.py @@ -5,6 +5,9 @@ @click.command() @click.argument('filename', type=click.Path(exists=True, readable=True), nargs=1) def main(filename): + """Usage: + run `python rigatonibot/cli.py `, + it will create and output via terminal your `paste.rs` link""" path = Path(filename).as_posix() with open(path, 'r') as file: From 192b93a6a3e403f48be23173a19ecdf245cb927d Mon Sep 17 00:00:00 2001 From: gabriel Date: Sun, 27 Oct 2019 20:14:43 -0300 Subject: [PATCH 5/5] changed function name --- rigatonibot/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rigatonibot/cli.py b/rigatonibot/cli.py index caa3261..fc8e6f1 100644 --- a/rigatonibot/cli.py +++ b/rigatonibot/cli.py @@ -4,7 +4,7 @@ @click.command() @click.argument('filename', type=click.Path(exists=True, readable=True), nargs=1) -def main(filename): +def cli(filename): """Usage: run `python rigatonibot/cli.py `, it will create and output via terminal your `paste.rs` link""" @@ -17,7 +17,7 @@ def main(filename): print(web_address.text) if __name__ == '__main__': - main() + cli() # Ta esse eh o unico arquivo que soh eu tenho por enquanto: