awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.17k stars 772 forks source link

Add lexer/syntax highlighting to visually distinguish the different components of a command #27

Closed donnemartin closed 8 years ago

donnemartin commented 8 years ago

A lexer would make it easier to visually distinguish the different components of a command:

 aws [options] <command> <subcommand> [parameters]

Config File

Default theme: vim

# visual theme. possible values: manni, igor, xcode, vim,
# autumn,vs, rrt, native, perldoc, borland, tango, emacs,
# friendly, monokai, paraiso-dark, colorful, murphy, bw,
# pastie, paraiso-light, trac, default, fruity.
# to disable themes, set theme = none
theme = vim

Disable Syntax Highlighting

 theme = none

Sample: Dark Background

 theme = vim

Imgur

Samples: Light Background

 theme = vim

Note: My terminal colors are customized which might be why we see light gray for aws>.

Imgur

 theme = xcode

Imgur

jamesls commented 8 years ago

I think this would be great. The only concern I have, as you mentioned in your TODO, is being able to have color themes. Either that or ensuring the color theme is neutral enough (for now) that it works for both dark and light backgrounds.

donnemartin commented 8 years ago

I tried a few themes on white background--some work better than others, which I think is expected. I'll do some more tweaks to try to make the lexer more neutral, at least for the default theme.

I've hooked it up so that setting theme = none will disable the lexer.

Below are the supported themes:

# visual theme. possible values: manni, igor, xcode, vim,
# autumn,vs, rrt, native, perldoc, borland, tango, emacs,
# friendly, monokai, paraiso-dark, colorful, murphy, bw,
# pastie, paraiso-light, trac, default, fruity.
# to disable themes, set theme = none
theme = vim
donnemartin commented 8 years ago

I updated the initial comment with the proposed UI.

donnemartin commented 8 years ago

Implementation merged in 9149483166ac1c294aa3e8a2392c3d350e7ee852.