-
Notifications
You must be signed in to change notification settings - Fork 14
Pry Theme CLI
Pry Theme has a command-line interface available via Pry. Just launch Pry and start working with it. But first, let's learn about the available subcommands.
- list — show a list of all installed themes
- colors — show all available colors
- try — change theme on the fly (for the current session only)
- edit — edit a theme definition
- uninstall — uninstall a theme
- install — install a theme from Pry Theme Collection
- current — show information about currently active theme
- convert — convert the given color to proper terminal equivalent
Show a list of all installed themes.
-r|--remote
— show a list of all themes from Pry Theme Collection. Possible arguments: none.
Accepts no arguments itself.
Show a list of local themes (watch):
[1] pry(main)> pry-theme list
monokai / 256
Based on Wimer Hazenberg's theme
--
1: class Theme
2: def method
3: @ivar, @@cvar, lvar = 10_000, 400.00, "string"
4: end
5: end
pry-modern-8 / 8
Simplied version of pry-modern-16
--
1: class Theme
2: def method
3: @ivar, @@cvar, lvar = 10_000, 400.00, "string"
4: end
5: end
…
Show a list of all remote themes (watch):
[1] pry(main)> pry-theme list --remote
Fetching the list of themes from Pry Theme Collection...
→ https://github.com/kyrylo/pry-theme-collection/
--
1. autumn
http://is.gd/1XrvaH
2. dominikh
http://is.gd/Dd1VVt
…
Show all available colors
-m|--model
— display colors according to the given color model. Possible arguments: 8
, 16
and 256
.
Accepts no arguments itself.
Without the --model
switch it displays the colors according to your terminal color capabilities (watch):
[1] pry(main)> pry-theme colors
Color model 256:
0:black 86:aquamarine03 172:siena
1:maroon 87:cyan01 173:dark_salmon
2:toad_in_love 88:maroon01 174:puce01
3:olive 89:eggplant01 175:puce2
…
Display only 8 colors (according to the 8 color model) (watch):
[1] pry(main)> pry-theme colors --model 8
Color model 8: 0:black 1:red 2:green 3:yellow 4:blue 5:magenta 6:cyan 7:white
Change theme on the fly (for the current session only).
Accepts 1 argument, which is a name of the installed theme.
Temporary switch to the Solarized theme (watch):
[1] pry(main)> pry-theme try solarized
Using "solarized" theme
[2] pry(main)>
Edit a theme definiton. The command opens a theme in the editor you defined in Pry.config.editor
. After you finished editing the theme, just exit the editor. Pry Theme will show you “before” and “after” snapshots and then reload theme (but it will not try
it). This command is very useful if you use console based text editors (like Vim).
I find that cheatsheet very useful, because it shows code examples and appropriate token names.
Accepts 1 argument which is a name of the installed theme. Without the argument edits current theme.
Editing current theme (watch):
[1] pry(main)> pry-theme edit
Opened in vim: /home/curacao/.pry/themes/zenburn.prytheme.rb
--------------------------------------------------------------------------------
Current "zenburn"
--------------------------------------------------------------------------------
# "zenburn" theme.
class PryTheme::ThisIsAClass
…
--------------------------------------------------------------------------------
Edited "zenburn"
--------------------------------------------------------------------------------
# "zenburn" theme.
class PryTheme::ThisIsAClass
…
Editing solarized theme (watch):
[1] pry(main)> pry-theme edit solarized
Opened in vim: /home/curacao/.pry/themes/solarized.prytheme.rb
--------------------------------------------------------------------------------
Current "solarized"
--------------------------------------------------------------------------------
# "solarized" theme.
class PryTheme::ThisIsAClass
…
--------------------------------------------------------------------------------
Edited "solarized"
--------------------------------------------------------------------------------
# "solarized" theme.
class PryTheme::ThisIsAClass
…
Uninstall a theme. Note that you cannot uninstall the default themes. Technically, you can do that, but they'll be restored on the next run of Pry.
Accepts multiple parameters that are theme names.
Uninstalling solarized and zenburn themes (they'll be restored anyway) (watch):
[1] pry(main)> pry-theme uninstall solarized zenburn
Successfully uninstalled "solarized"!
Successfully uninstalled "zenburn"!
[2] pry(main)>
Install a theme from Pry Theme Collection.
Accepts multiple parameters that are theme names.
Installing xoria256 theme (watch):
[1] pry(main)> pry-theme install autumn
Installing "autumn" from Pry Theme Collection...
Successfully installed "autumn"!
[2] pry(main)>
Show information about currently active theme. Without the --colors
switch displays current theme name.
-c|--colors
— display a painted code snippet. Possible arguments: none.
Accepts no arguments itself.
Showing current theme name (watch):
[1] pry(main)> pry-theme current
zenburn
Showing current theme colors (watch):
[1] pry(main)> pry-theme current --colors
# "zenburn" theme.
class PryTheme::ThisIsAClass
…
Convert the given color to proper terminal equivalent.
-t|--term
— show a terminal color. Possible arguments: 0-255.
-h|--hex
— convert from HEX. Possible arguments: #000000-#FFFFFF.
-r|--rgb
— convert from RGB. Possible arguments: 0,0,0-255,255,255.
-m|--model
— convert accordingly to the given color model. Possible arguments: 8
, 16
and 256
.
Accepts no arguments itself.
Omitting the --model
switch, so Pry Theme would guess it (different effect on different terminals) (watch):
[1] pry(main)> pry-theme convert --term 200
200:hot_pink03
[2] pry(main)>
Exactly the same invocation as the previous one (watch):
[1] pry(main)> pry-theme convert --model 256 --term 200
200:hot_pink03
[2] pry(main)>
Using the --term
switch (watch):
[1] pry(main)> pry-theme convert --model 16 --term 15
37;1:bright_white
[2] pry(main)>
Using the --hex
switch (watch):
[1] pry(main)> pry-theme convert --model 8 --hex #EA00AA
35:magenta
[2] pry(main)>
Using the --rgb
switch (watch):
[1] pry(main)> pry-theme convert --model 256 --rgb 23,101,0
22:dark_spring_green
[2] pry(main)>