Julien-cpsn / ATAC

A simple API client (postman like) in your terminal
https://atac.julien-cpsn.com/
MIT License
1.86k stars 81 forks source link

fix(quit): allow to quit atac inside selected requests #50

Closed NachoNievaG closed 1 month ago

NachoNievaG commented 5 months ago

Proposal

I always find myself executing a request, copying the result, and trying to quit as soon as i copy the result. But currently quitting with q only works in the "normal" view, so quitting requires ctrl+c or Esc -> q. With this, you will be able to quit using q on a selected request. Thanks!

Julien-cpsn commented 4 months ago

Hello @NachoNievaG

I understand what is your problem, but I found another problem with what you did.

On platforms such as Windows or many Linux distros, ctrl-c is used to copy text from the terminal. Imagine that I want to manually copy the request URL onto my clipboard, with your code it will exit the app (without even copying the text).

If you find another way, let me know! I'll try to think about that in "passive" mode

Have a great day!!!

Julien-cpsn commented 4 months ago

@NachoNievaG I took some time to think of something that could resolve your problem without needing a special implementation, and I think I found it!

One of the next features that I will work on will be command line usage. As we discussed it a little on the import curl PR, I will try to make it very complete.

E.g. regarding your problem, you could send a request with

atac send my_collection/my_request

By default it will return the response body. But by adding things like -s --status-code, -h --headers, -c --cookies, --console or --no-content the app will output will be kind of customized.

Back to your problem, you could simply copy the output from the command line usage. What about that?

Have a great day!

NachoNievaG commented 4 months ago

@Julien-cpsn I'm really sorry but it does not. In this particular scenario it makes a weird experience for closing the program.

In a "fast" workflow as soon as i get the output i would like to be able to quit the program/floating term. PS: the circle with an arrow it's the prompt for "Esc"

Natural TUI example

https://github.com/Julien-cpsn/ATAC/assets/83428506/0134811c-0ee5-463d-85d6-27d1a16046a6

Neovim Plugin example

https://github.com/Julien-cpsn/ATAC/assets/83428506/f62d5cd0-4f24-478c-a7a9-b19d454662ee

Maybe i'm not using the software as intended to be.

Julien-cpsn commented 1 month ago

Will be added to the next version

Julien-cpsn commented 1 month ago

https://github.com/Julien-cpsn/ATAC/commit/3118bf800619997818ef5ba1ed4db8943ea69ce1