julien-cpsn / atac Goto Github PK
View Code? Open in Web Editor NEWA simple API client (postman like) in your terminal
Home Page: https://atac.julien-cpsn.com/
License: MIT License
A simple API client (postman like) in your terminal
Home Page: https://atac.julien-cpsn.com/
License: MIT License
Just a suggestion, can you add support for yaml as the input for the collection, yaml is more human friendly, for read and write. You can also have references (anchors) to reduce repetitive blocks.
Just a thought :)
There are times where you want to generate a UUID or a timestamp in the header to be able to track a request. Would be nice if we could do {{UUID}} or {{TIMESTAMP}} to automatically generate this and insert it like with env variables.
TL&DR; add the ability to import cURL please!
Full explanation:
It would be a useful feature to be able to import a request from cURL.
Currently, browsers such as Firefox and Chromium allow you to select a request and click Copy
> Copy as cURL
. This is very convenient, because you can immediately start altering your request in CLI if you want.
Native support for that in atac could look like an import feature, upon which the cURL command line would be read (from user's input), parsed and transformed into an atac request.
Thank you for the tool!
I haven't found binding to scroll results window or ability to save response to the output file.
an option to add the authorization to collection config.
workflow:
if the Authorization params is not passed to request headers will verify if has in the collection config.
i think if has this feature will be good to users who have a big collection.
you can take some reference from httpie-desktop client.
Hi,
I was trying yours and openapi-tui
and I was surprised that there is no option to read autogenerated or static openapi schema in your tool.
I'm using fastapi, which generates schema dynamically on API start and which is accessible on localhost:port/openapi.json
. I would like to have option to read this schema and have it loaded under default collection name.
Later the collection can be renamed according the users needs. I think this saves user a lot of work from creating new collections.
Otherwise great tool. Thank you.
In English "validate" is closest to the concept of input validation, while "confirm" should be more correct ๐ค
From the ReadMe.md
:
Install from Fedora copr
Simply use:
dnf enable joxcat/atac dnf install atac
This snippet contains a mistake. The correct command to enable the package repository is dnf copr enable joxcat/atac
.
I am using an M1 based Macbook
When installing from homebrew I had to manually add the execute bit.
chmod +x /opt/homebrew/Cellar/atac/0.11.3/bin/atac
The binary is for X64 rather than ARM so I can't run it
(PS -- This looks like a cool tool so will install from binary for now)
Response body has syntax highlighting. Can something similar be applied to the headers section? At least to differentiate a header from its content.
Do you have any plan to support homebrew install?
It's a convenient way to make your tool available for everyone, and it helps to keep the tool up to date
First of all, great project.
I encountered an issue when installing atac from AUR in arch linux.
Tried both yay
and paru
, I get an error:
==> Validating source files with sha512sums...
atac-0.12.0.tar.gz ... FAILED
==> ERROR: One or more files did not pass the validity check!
-> error making: atac-exit status 1
Seems like checksum validation fails.
https://github.com/Julien-cpsn/ATAC/blob/main/src/app/ui/param_tabs/headers_tab.rs#L117 throws 'attempt to subtract with overflow' when pressing enter in the response body view, avoid this by using wrapping_sub:
let text_input = Paragraph::new(format!("{:fill$}", header_text, fill = cell_width.wrapping_sub(horizontal_margin) as usize));
Steps:
Set ATAC_MAIN_DIR to empty folder ~/.atac
Ran atac, importing a JSON postman file
Issued a request from the config
Upon hitting space, the application crashes with the following message:
thread 'main' panicked at src/app/app_logic/environment:12:26
index out of bounds: the len is 0 but the index is 0
Forgot to return a response in an endpoint and realized I couldn't cancel the request from ATAC; the only way I was able to was by closing the app and rerunning atac.
Now ATAC (version 0.15.1) must be given a working directory on startup.
IMHO, a tui application can use the default directory specified by the OS, i.e:
OS | config directory | cache directory |
---|---|---|
Linux | /home/alice/.config/barapp |
/home/alice/.cache/barapp |
Windows | C:\Users\Alice\AppData\Roaming\Foo Corp\Bar App\config |
C:\Users\Alice\AppData\Local\Foo Corp\Bar App\cache |
MacOS | /Users/Alice/Library/Application Support/com.Foo-Corp.Bar-App |
/Users/Alice/Library/Caches/com.Foo-Corp.Bar-App |
(Suppose the user name is Alice
, the organization name is Foo Corp
and the application name is Bar App
).
All this can be easily handled by the directory
crate:
[dependencies]
directories = "5"
// these are just examples, there must be some other much more better options
// and if you want the `ORGANIZATION` be present on Linux, some thing like `#[cfg(target_os = "linux")]` can be used
pub const APP_NAME: &str = "ATAC";
pub const QUALIFIER: &str = "fr";
pub const ORGANIZATION: &str = "Julien";
let project_dir = directories::ProjectDirs::from(QUALIFIER, ORGANIZATION, APP_NAME).unwrap();
let config_dir = project_dir.config_dir();
let cache_dir = project_dir.cache_dir();
let mut log_dir = cache_dir.to_owned();
log_dir.push("logs");
Looks good and runs in my terminal. I can configure requests, but how can I actually SEND a request?
after running:
cargo install atac
to install ATAC, I face this error:
in /postman.rs:278:50
|
278 | let request_body = match language {
| ^^^^^^^^ pattern `Language::Javascript` not covered
|
note: `Language` defined here
/mod.rs:448:1
|
448 | pub enum Language {
| ^^^^^^^^^^^^^^^^^
...
462 | Javascript,
| ---------- not covered
= note: the matched value is of type `Language`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
282 ~ Language::Xml => ContentType::Xml(body_as_raw),
283 + Language::Javascript => todo!()
|
For more information about this error, try `rustc --explain E0004`.
error: could not compile `atac` (bin "atac") due to 1 previous error
error: failed to compile `atac v0.13.0`, intermediate artifacts can be found at `/tmp/cargo-installL1VJs5`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
but the source code actually has this match value for Language
enum covered as can be seen:
in /postman.rs
return match body_mode {
Mode::Raw => {
let body_as_raw = body.raw?;
if let Some(options) = body.options {
let language = options.raw?.language?;
let request_body = match language {
Language::Html => ContentType::Html(body_as_raw),
Language::Json => ContentType::Json(body_as_raw),
Language::Text => ContentType::Raw(body_as_raw),
Language::Xml => ContentType::Xml(body_as_raw),
Language::Javascript => ContentType::Javascript(body_as_raw),
};
Some(request_body)
} else {
Some(ContentType::Raw(body_as_raw))
}
}
what seems to be the problem, can somebody explain this? Thanks
Hello. I was looking for a TUI alternative for Postman and I'm glad I found this awesome project.
I'm having some issues though. I'd like to import my collections from Postman to ATAC, but while the feature matrix lists Collection v2.1.0 as supported, I get the following error whenever trying to import the .json file:
Error:
Could not parse JSON collection
missing field name at line 914 column 1
I attached the json file here:
SoundCloud Web API.postman_collection.json
I'm suspecting it may be that the variables aren't handled properly?
Is it planned to have Vim motions in general navigation and editing?
I think your project could benefit from existing GitHub actions that check for typos in code, comments and documentation
Being a vim user I was using rest.nvim, it covers my day to day usage except for few cases like file upload. So was always looking for a lightweight alternative of Postman. Thank you so much for a lightweight client.
I tried using the vim bindings provided in the repo, it unfortunately didn't work as expected, it usually causes conflicts when editing values. For example the default binding used to display help is H
, Now when editing the URL, if I were to type variable name HOST
, I am not able to do so because the moment I type H
it opens up the help menu.
As a workaround I can remap the help binding but that would cause conflict with some other key which I will need to remap.
So I am suggesting to implement vim modes like NORMAL
and INSERT
, where in INSERT
mode no keys will trigger the binding action and ESC key can change the mode back to NORMAL.
Similar implementation can be found in this terminal file manager yazi
Sample clip from their demo:
OR
We can add an option to open the content in preferred editor using $EDITOR where user can edit the content and edited content can be conveyed back to ATAC, this will provide more flexibility and user can utilise the syntax highlighting of the editor as well.
When pasting a large token (in macOS at least) you can see a weird behavior after a certain delay.
The issue with this is that it results in a bad pasting as the sample token ends with SWYY
, yet the pasted one in the TUI ends with mlzd
When specifying a tmpfs location as an argument to --directory
, the application panics unexpectedly.
$ atac -d /tmp
parsing: /tmp/mat-debug-91998.log
thread 'main' panicked at src/app/startup/startup.rs:55:17:
unhandled file type
stack backtrace:
0: 0x55b7dbc36f86 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h410d4c66be4e37f9
1: 0x55b7dbc64e40 - core::fmt::write::he40921d4802ce2ac
2: 0x55b7dbc3355f - std::io::Write::write_fmt::h5de5a4e7037c9b20
3: 0x55b7dbc36d64 - std::sys_common::backtrace::print::h11c067a88e3bdb22
4: 0x55b7dbc38797 - std::panicking::default_hook::{{closure}}::h8c832ecb03fde8ea
5: 0x55b7dbc384f9 - std::panicking::default_hook::h1633e272b4150cf3
6: 0x55b7dbc38c28 - std::panicking::rust_panic_with_hook::hb164d19c0c1e71d4
7: 0x55b7dbc38ac9 - std::panicking::begin_panic_handler::{{closure}}::h0369088c533c20e9
8: 0x55b7dbc37486 - std::sys_common::backtrace::__rust_end_short_backtrace::hc11d910daf35ac2e
9: 0x55b7dbc38854 - rust_begin_unwind
10: 0x55b7db6a8d85 - core::panicking::panic_fmt::ha6effc2775a0749c
11: 0x55b7db6d177c - atac::app::startup::startup::<impl atac::app::app::App>::startup::hb0dbb4ca5eb46b2f
12: 0x55b7db7742b1 - tokio::runtime::park::CachedParkThread::block_on::he0f8c1c457bbf1b1
13: 0x55b7db75039a - tokio::runtime::context::runtime::enter_runtime::hf17d553f5e0f270a
14: 0x55b7db78297e - tokio::runtime::runtime::Runtime::block_on::h54ffd2db751dfad6
15: 0x55b7db7570d9 - atac::main::h26d3a8c116b6fb46
16: 0x55b7db73e903 - std::sys_common::backtrace::__rust_begin_short_backtrace::hea90534575b9fc13
17: 0x55b7db79200d - std::rt::lang_start::{{closure}}::h5c94db54965fe6bb
18: 0x55b7dbc2d491 - std::rt::lang_start_internal::h4d236095b69a230b
19: 0x55b7db7571b5 - main
20: 0x7f2819dce24a - __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
21: 0x7f2819dce305 - __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
22: 0x55b7db6a95d5 - _start
23: 0x0 - <unknown>
I haven't dug any deeper. It should be easily reproducible.
Looks like it should be a quick fix. Cool project! :-)
Merci!
Unsing the tool on a Mac I can create several collections but when I add a request it is always added to the first collection, regardless which collection is selected.
just a suggestion here, i think it would be great if the config directory ~/.config/atac
can be used instead of env variables
If you try to create a new request without having created a collection already, nothing happens when you press enter. This is a bit confusing.
One possible solution would be to create a default collection if this occurs. Maybe a collection with the name other
.
Another approach could be to show a warning message.
Hello,
Scrolling through the response doesn't work on mac, probably due to ctrl + arrows already having OS wide bindings
@Julien-cpsn I see you are pushing commit into main without using PR.
I would like to suggest you to push your code changes in feature branch, then use PR when you want to merge a feature.
I think it would be better because you could get feed back from community, or people may add reference to PR to point bugs or ask question.
Just a suggestion.
https://cli.github.com/ can help you to achieve that.
When I am trying to upgrade from 0.12 to 0.13 using cargo install atac
,
I get this error:
error[E0004]: non-exhaustive patterns: `Language::Javascript` not covered
--> C:\Users\anton.sagel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\atac-0.13.0\src\app\files\postman.rs:278:50
|
278 | let request_body = match language {
| ^^^^^^^^ pattern `Language::Javascript` not covered
|
note: `Language` defined here
--> C:\Users\anton.sagel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\parse_postman_collection-0.2.3\src\v2_1_0\mod.rs:448:1
|
448 | pub enum Language {
| ^^^^^^^^^^^^^^^^^
...
462 | Javascript,
| ---------- not covered
= note: the matched value is of type `Language`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
282 ~ Language::Xml => ContentType::Xml(body_as_raw),
283 + Language::Javascript => todo!()
|
Cli tooling and help menu not displaying properly:
Got the same result from cloning and running cargo run
and downloading the binary executable and running it directly.
Using:
x86_64
Hit me up for details ๐
Hello,
firstly I wanna say that I really like how ATAC performs. After getting used to the keybindings it was super easy!
I'm now wondering how the scripting feature works (exposed variables, etc.).
It seems that part is missing in the docs or at least I couldn't find it.
I could only find the reference to the boa engine.
Greetings,
Chris
thread 'main' panicked at C:\Users\jjara.cargo\registry\src\index.crates.io-6f17d22bba15001f\ratatui-0.26.2\src\widgets\scrollbar.rs:569:10:โโโโโโโโโโโโโโโโโโโโโโโโโโ
Scrollbar area is emptylt body (301.07ms) โ Cookies โ Headers
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
Steps to reproduce:
one
, two
, and three
.n
to bring up the create dialog and select request
. The selected collection should be three
up
repeatedly and the selected collection will alternate between two
and three
instead of cycling through one
, two
, and three
. If you hit down
it will cycle correctly between all three collections.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.