Giter Site home page Giter Site logo

atac's Introduction

ATAC โš”๐Ÿ“ฉ

Rust License: MIT GitHub Release

Demo Animation

Table Of Contents

Description

ATAC is Arguably a Terminal API Client. It is based on well-known clients such as Postman, Insomnia, or even Bruno, but inside your terminal without any specific graphical environment needed.

The philosophy of ATAC is to be free, account-less, and offline for now and forever.

How to install

Packaging status

crates.io package

Install with cargo

Important

First, make sure your rust version is at least 1.76

Simply use:

cargo install atac
Arch package

Install from Arch

You can use pacman to install:

pacman -S atac

Install with Homebrew

Simply use:

brew tap julien-cpsn/atac
brew install atac
Fedora copr Release

Install from Fedora copr

Simply use:

dnf enable joxcat/atac
dnf install atac
GitHub Release

Binary

The binaries from the latest release can be found here

Important

Remember to run it from a terminal. For example, you can add the binary into your PATH. You won't be able to run it like other graphical applications since it needs CLI arguments.

Tip

Note for macOS users. After downloading the binary you may need to run the command sudo xattr -rd com.apple.quarantine ~/bin/atac (modify to reflect the path where atac is located).

Compile by yourself

Important

First, make sure your rust version is at least 1.76

Simply clone the repository and use:

cargo run
cargo run -- -h

Tip

Build the latest release

cargo build --release

Features

Current

Features ATAC Postman Insomnia
Manage collections & requests โœ… โœ… โœ…
HTTP Client โœ… โœ… โœ…
Methods โœ… โœ… โœ…
- GET โœ… โœ… โœ…
- POST โœ… โœ… โœ…
- PUT โœ… โœ… โœ…
- PATCH โœ… โœ… โœ…
- DELETE โœ… โœ… โœ…
- HEAD โœ… โœ… โœ…
- OPTIONS โœ… โœ… โœ…
Authentication Partial โœ… โœ…
- Basic auth โœ… โœ… โœ…
- Bearer token โœ… โœ… โœ…
- JWT, Digest, OAuth1-2, AWS โŒ ๐Ÿ”œ โœ… โœ…
Headers โœ… โœ… โœ…
Body โœ… โœ… โœ…
- Multipart form โœ… โœ… โœ…
- URL Encoded form โœ… โœ… โœ…
- File โœ… โœ… โœ…
- Plain text โœ… โœ… โœ…
- JSON, XML, HTML, Javascript โœ… โœ… โœ…
Full response โœ… โœ… โœ…
- Status code โœ… โœ… โœ…
- Cookies โœ… โœ… โœ…
- Headers โœ… โœ… โœ…
- Duration โœ… โœ… โœ…
Scripting โœ… Partial โŒ
- Pre-request script โœ… โŒ โŒ
- Post-request script โœ… โœ… โŒ
Asynchronous requests โœ… โœ… โœ…
Per-request settings โœ… โœ… โœ…
- Use proxy โœ… โœ… โœ…
- Allow redirects โœ… โœ… โœ…
- Store cookies โœ… โœ… โœ…
Export to other languages โŒ ๐Ÿ”œ โœ… โŒ
WebSocket Client โŒ ๐Ÿ”œ โœ… โœ…
GraphQL โŒ ๐Ÿ”œ โœ… โœ…
gRPC โŒ ๐Ÿ”œ โœ… โœ…
MQTT โŒ ๐Ÿ”œ โœ… โŒ
Free โœ… Depends Depends
Lightweight, fast and efficient โœ… โŒ โŒ
Data storage Your own committable, readable and versioned files (JSON or YAML) Tied to your account Tied to your account
Offline โœ… โŒ โŒ
Real-time collaboration โŒ (not planned) โœ… โœ…
Environment files and variables โœ… (committable, readable and versioned) โœ… โœ…
View options โœ… โœ… โœ…
Global configuration file โœ… โœ… โœ…
- HTTP/HTTPS Proxy โœ… โœ… โœ…
- Disable CORS โœ… โŒ โŒ
- Toggle syntax highlighting โœ… โŒ โŒ
Postman v2.1.0 import โœ… โœ… โœ…
OpenAPI import โŒ ๐Ÿ”œ โœ… โœ…

TODO v1.0.0

  • To add

    • Create a repo wiki
    • Document the whole code
    • Command line usage (send requests, add new requests)
    • Request body syntax highlighting
    • Export a request to other code formats (raw, curl, PHP, JS, Rust, ...)
    • OpenAPI & Insomnia import
  • To improve

    • Editing cookies
    • Auto-completion on env file variables
    • Manage multipart Content-type header (auto-generated for now) seanmonstar/reqwest#2259
  • To fix

    • Query parameters bug

TODO v2.0.0

  • To add
    • WebSocket requests
    • Maybe GraphQL requests
    • Maybe MQTT requests
    • Maybe gRPC requests

Ideas (will think about it later)

  • Base URL property on collections

Documentation

Note

Documentation will soon be published in the wiki section

Others

Vim key-bindings

You can read more about it here: https://github.com/Julien-cpsn/ATAC/releases/tag/v0.14.0

NeoVim integration

Thanks to @NachoNievaG you can have an ATAC floating window inside your nvim https://github.com/NachoNievaG/atac.nvim

Technical precisions

Tested on

  • Console Host
    • Windows 11 (Pro)
    • WSL2 Debian
    • Windows 10 (Pro)
    • Windows 8.1 (N)
  • Ubuntu Desktop Terminal
    • Ubuntu 17.10
    • Pop!_OS 20.04
  • (Arch, Manjaro) KDE Konsole
  • (Arch, NixOS) Kitty
  • Linux Mint
  • (OpenSuse) Alacritty
  • (Chrome OS) Crostini

(List from here)

Dependencies

Library Version Reason
reqwest & reqwest cookie store 0.11.27 & 0.6.0 Send requests
ratatui 0.26.2 Terminal UI framework
crossterm 0.27.0 Terminal Backend
crokey 0.6.4 Used to parse, use key bindings files and some utilities
tui-big-text 0.4.2 Display big texts. Only used for displaying ATAC in the homepage.
tui-tree-widget 0.19.0 Display tree-like lists. Used for displaying the collections.
tui-textarea 0.5.0 Text area that handle a lot of features. Used for editing request body.
throbber-widgets-tui 0.4.1 Display loading UI elements. Used when request is pending.
ratatui-image 1.0.0 Display response images.
image 0.24.9 Decode images.
syntect 5.2.0 Syntax highlighting
serde (serde_json, serde-yaml) 1.0.197 (1.0.144, 0.9.34) Serialize & Deserialize application data into files
jsonxf 0.1.1 Pretty print JSON
toml 0.8.11 Serialize & Deserialize application config files
boa_engine 0.18.0 Create Javascript runtimes. Used for pre and post request scripts
My fork of postman_collection 0.2.1 Deserialize Postman collection files
curl-parser 0.3.1 Parse cURL request files
clap 4.5.0 Command Line Argument Parser
arboard 3.3.2 Copy response body to clipboard
tokio 1.0.0 Handle asynchronous requests
parking_lot 0.12.2 Smaller, faster and more flexible implementation of RwLock and Mutex. Used everywhere.
strum 0.26.2 Enum facilities
lazy_static 1.4.0 Allows for more flexible constants. Mainly used for accessing CLI arguments everywhere
nestify 0.3.3 Used to nest struct definitions
walkdir 2.5.0 Recursively retrieve files
snailquote 0.3.1 Unescape string
indexmap 2.2.6 Ordered hashmap. Used in environments to preserve files' values order
base64 0.22.0 Encode auth.
regex 1.10.3 Regex. Using for parsing requests URL

Binary size

The binary file size goes from ~4.5 MB to ~7 MB depending on the platform. I try to keep it as small as possible.

Contributors

Maintainers

Packagers

Star history

Star History Chart

License

The MIT license for this project can be seen here

atac's People

Contributors

airone01 avatar alecthegeek avatar ccoveille avatar joxcat avatar julien-cpsn avatar jwtly10 avatar kalinivanov-l avatar orhun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

atac's Issues

feat:Authorization is passed to collection not to individual request.

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.

Cannot install from AUR - "One or more files did not pass the validity check"

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.

Homebrew integration/tap

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

[BUG] Padding glitch

Cli tooling and help menu not displaying properly:

asciicast

Got the same result from cloning and running cargo run and downloading the binary executable and running it directly.

Using:

Hit me up for details ๐Ÿ‘

my response body not word wrap

i am hit this [https://dummyjson.com/products] but show result respond like this ?

{"products":[{"id":1,"title":"iPhone 9","description":"An apple mobile which is nothing like aโ–ˆ

image

Vim Motions

Is it planned to have Vim motions in general navigation and editing?

index out of bounds: the len is 0 but the index is 0

Hey o/

I am trying to run this http request:
image

But I keep getting this error:

index out of bounds: the len is 0 but the index is 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here is my PC neofetch

image

Feature Request: use default `directory` if not specified

Now ATAC (version 0.15.1) must be given a working directory on startup.
image

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");

How to send a request?

Looks good and runs in my terminal. I can configure requests, but how can I actually SEND a request?

issue install on windows using cargo install

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!()
    |

[bug] unexpected panic when specifying `--directory` of a tmpfs

Issue Description

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!

Install from Homebrew is not working

I am using an M1 based Macbook

  1. When installing from homebrew I had to manually add the execute bit.

     chmod +x  /opt/homebrew/Cellar/atac/0.11.3/bin/atac
  2. 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)

non-exhaustive patterns: `Language::Javascript` not covered

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

Import from cURL (feature)

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!

Crash when sending a request (index out of bounds)

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

Add headers highlighting

Response body has syntax highlighting. Can something similar be applied to the headers section? At least to differentiate a header from its content.

Support the input file format to YAML

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 :)

Development workflow

@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.

Unable to see all collections when creating a new request and scrolling up

Steps to reproduce:

  1. Start atac in a new directory.
  2. Create three projects, one, two, and three.
  3. Hit n to bring up the create dialog and select request. The selected collection should be three
  4. Hit 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.

[ux] selecting creating request without existing collection has no effect

Issue Description

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.

Possible Solutions

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.

Crash try use scroll

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.