mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 23:48:01 -05:00
Add option to enable/disable colorful output (#4996)
This commit is contained in:
29
crew
29
crew
@@ -20,25 +20,27 @@ DOC = <<DOCOPT
|
||||
Chromebrew - Package manager for Chrome OS http://skycocker.github.io/chromebrew/
|
||||
|
||||
Usage:
|
||||
crew build [-k|--keep] [-v|--verbose] <name> ...
|
||||
crew const [<name> ...]
|
||||
crew download [-v|--verbose] <name> ...
|
||||
crew files <name> ...
|
||||
crew build [options] [-k|--keep] <name> ...
|
||||
crew const [options] [<name> ...]
|
||||
crew download [options] <name> ...
|
||||
crew files [options] <name> ...
|
||||
crew help [<command>]
|
||||
crew install [-k|--keep] [-s|--build-from-source] [-S|--recursive-build] [-v|--verbose] <name> ...
|
||||
crew list (available|installed|compatible|incompatible)
|
||||
crew postinstall <name> ...
|
||||
crew reinstall [-k|--keep] [-s|--build-from-source] [-S|--recursive-build] [-v|--verbose] <name> ...
|
||||
crew remove [-v|--verbose] <name> ...
|
||||
crew search [-v|--verbose] [<name> ...]
|
||||
crew update
|
||||
crew upgrade [-k|--keep] [-s|--build-from-source] [-v|--verbose] [<name> ...]
|
||||
crew whatprovides <name> ...
|
||||
crew install [options] [-k|--keep] [-s|--build-from-source] [-S|--recursive-build] <name> ...
|
||||
crew list [options] (available|installed|compatible|incompatible)
|
||||
crew postinstall [options] <name> ...
|
||||
crew reinstall [options] [-k|--keep] [-s|--build-from-source] [-S|--recursive-build] <name> ...
|
||||
crew remove [options] <name> ...
|
||||
crew search [options] [<name> ...]
|
||||
crew update [options]
|
||||
crew upgrade [options] [-k|--keep] [-s|--build-from-source] [<name> ...]
|
||||
crew whatprovides [options] <name> ...
|
||||
|
||||
-k --keep Keep the `CREW_BREW_DIR` (#{CREW_BREW_DIR}) directory.
|
||||
-s --build-from-source Build from source even if pre-compiled binary exists.
|
||||
-S --recursive-build Build from source, including all dependencies, even if pre-compiled binaries exist.
|
||||
-V --version Display the crew version.
|
||||
-c --color Use colors even if standard out is not a tty.
|
||||
-d --no-color Disable colors even if standard out is a tty.
|
||||
-v --verbose Show extra information.
|
||||
-h --help Show this screen.
|
||||
|
||||
@@ -76,6 +78,7 @@ rescue Docopt::Exit => e
|
||||
exit 1
|
||||
end
|
||||
|
||||
String.use_color = args["--color"] || !args["--no-color"]
|
||||
@opt_keep = args["--keep"]
|
||||
@opt_verbose = args["--verbose"]
|
||||
|
||||
|
||||
12
lib/color.rb
12
lib/color.rb
@@ -1,7 +1,17 @@
|
||||
# Colorization for strings
|
||||
class String
|
||||
@use_color = STDOUT.isatty
|
||||
|
||||
class << self
|
||||
attr_accessor :use_color
|
||||
end
|
||||
|
||||
def colorize(color_code, shade)
|
||||
"\e[#{shade};#{color_code}m#{self}\e[0m"
|
||||
if self.class.use_color
|
||||
return "\e[#{shade};#{color_code}m#{self}\e[0m"
|
||||
else
|
||||
return self
|
||||
end
|
||||
end
|
||||
|
||||
def black
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Defines common constants used in different parts of crew
|
||||
|
||||
CREW_VERSION = '1.6.0'
|
||||
CREW_VERSION = '1.7.0'
|
||||
|
||||
ARCH_ACTUAL = `uname -m`.strip
|
||||
# This helps with virtualized builds on aarch64 machines
|
||||
|
||||
Reference in New Issue
Block a user