httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.81k stars 3.68k forks source link

How to get native terminal colors? #653

Closed 9mm closed 6 years ago

9mm commented 6 years ago

This used to work and now it's using its own set of really ugly colors (I've tried the different themes). I was under the impression native was supposed to use native terminal colors.

Thanks!

jkbrzt commented 6 years ago

@9mm ~--style=native~ should do the trick. Do you have a screenshot?

9mm commented 6 years ago

You can see my terminal colors below for Vim and everything else. I put several colors so you can see how multiple terminal apps are properly using the same colors, and then http is far different.

image

image

image

jkbrzt commented 6 years ago

@9mm thanks. Can you also please include the output of http --debug?

9mm commented 6 years ago
HTTPie 0.9.9
Requests 2.12.3
Pygments 2.1.3
Python 3.6.4 (default, Jan  6 2018, 11:51:59)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
/usr/local/Cellar/httpie/0.9.9_1/libexec/bin/python3.6
Darwin 17.4.0

<Environment {
    "colors": 256,
    "config": {
        "__meta__": {
            "about": "HTTPie configuration file",
            "help": "https://httpie.org/docs#config",
            "httpie": "0.9.9"
        },
        "default_options": "['--style=native']"
    },
    "config_dir": "/Users/zesty/.httpie",
    "is_windows": false,
    "stderr": "<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>",
    "stderr_isatty": true,
    "stdin": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='UTF-8'>",
    "stdin_encoding": "UTF-8",
    "stdin_isatty": true,
    "stdout": "<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>",
    "stdout_encoding": "UTF-8",
    "stdout_isatty": true
}>
usage: http [--json] [--form] [--pretty {all,colors,format,none}]
            [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose]
            [--all] [--history-print WHAT] [--stream] [--output FILE]
            [--download] [--continue]
            [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH]
            [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow]
            [--max-redirects MAX_REDIRECTS] [--timeout SECONDS]
            [--check-status] [--verify VERIFY]
            [--ssl {ssl2.3,ssl3,tls1,tls1.1,tls1.2}] [--cert CERT]
            [--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version]
            [--traceback] [--default-scheme DEFAULT_SCHEME] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: the following arguments are required: URL
9mm commented 6 years ago

Does anything stand out at you as different about my config? :|

jkbrzt commented 6 years ago

@9mm nothing suspicious. I was mainly interested in the "colors": 256 bit.

jkbrzt commented 6 years ago

@9mm actually, two things 😄

  1. this feature hasn't been released yet
  2. the style is not called ~native~ (already taken) but preset

So, to have httpie use your lovely color scheme, install it form master and invoke it with --style=preset.

Also, #568 didn't update README and CHANGELOG (todo).

9mm commented 6 years ago

Oh, nice!

PS, I tried reinstalling with --HEAD on brew and got this:

Traceback (most recent call last):
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 666, in _build_master
    ws.require(__requires__)
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 984, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 875, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.12.3 (/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages), Requirement.parse('requests>=2.18.4'), {'httpie'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/http", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3147, in <module>
    @_call_aside
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3131, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3160, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 668, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 681, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/Cellar/httpie/HEAD-0f4dce9_1/libexec/lib/python3.6/site-packages/pkg_resources/__init__.py", line 870, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests>=2.18.4' distribution was not found and is required by httpie
jkbrzt commented 6 years ago

@9mm this should do the trick:

brew uninstall httpie
brew install --HEAD httpie
9mm commented 6 years ago

Unfortunately I did that and no dice. Do you know roughly when it will be released? Just estimate is fine, I could deal with the hideousness until then probably, although I do use http every day (great work btw)

jkbrzt commented 6 years ago

@9mm I hope to be able to ship v1.0.0 soon-ish.

9mm commented 6 years ago

ok cool, I'll just hang out until then. Thanks!

9mm commented 6 years ago

Do you have any further updates on what you plan to ship 1.0.0 which includes this color option? Thanks

9mm commented 6 years ago

Hey @jakubroztocil Just checking in again if we can use the native terminal theme yet. The colors are so insanely bad its impossible to read.

Cheers

acostalima commented 6 years ago

I've just installed httpie with brew and preset is not a valid style choice:

http: error: argument --style/-s: invalid choice: 'preset' (choose from 'colorful', 'murphy', 'rrt', 'bw', 'default', 'vim', 'solarized', 'fruity', 'manni', 'vs', 'xcode', 'lovelace', 'borland', 'pastie', 'perldoc', 'paraiso-dark', 'native', 'tango', 'igor', 'algol', 'friendly', 'autumn', 'monokai', 'algol_nu', 'paraiso-light', 'trac', 'emacs')
9mm commented 6 years ago

Yeah I'm still wondering when we can use the native color scheme, I thought it was coming with 1.0 but That was like 6 months ago