Commit 88dfe42a authored by Chris Thurber's avatar Chris Thurber Committed by GitHub

Merge pull request #2409 from uberhacker/add-const-command

Add const command
parents a0cc6548 37621db6
......@@ -57,17 +57,18 @@ Usage
Where available commands are:
* build [build package(s) from source and store the archive and checksum in the current working directory]
* download [download package(s) to `CREW_BREW_DIR` (`/usr/local/tmp/crew` by default), but don't install]
* files [display installed files of package(s).]
* help [get information about command usage]
* install [install package(s) along with dependencies after prompting for confirmation]
* list [available or installed packages]
* remove [remove package(s)]
* search [look for a package]
* update [update crew itself]
* upgrade [update all or specific package(s)]
* whatprovides [regex search for package(s) that contains file(s)]
* build - `build package(s) from source and store the archive and checksum in the current working directory`
* const - `display constant(s)`
* download - `download package(s) to CREW_BREW_DIR (/usr/local/tmp/crew by default), but don't install`
* files - `display installed files of package(s)`
* help - `get information about command usage`
* install - `install package(s) along with dependencies after prompting for confirmation`
* list - `available or installed packages`
* remove - `remove package(s)`
* search - `look for package(s)`
* update - `update crew itself`
* upgrade - `update all or specific package(s)`
* whatprovides - `regex search for package(s) that contains file(s)`
Available packages are listed in the [packages directory](https://github.com/skycocker/chromebrew/tree/master/packages).
......
......@@ -22,6 +22,7 @@ Chromebrew - Package manager for Chrome OS http://skycocker.github.io/chromebrew
Usage:
crew build [-k|--keep] [-v|--verbose] <name> ...
crew download [-v|--verbose] <name> ...
crew const [<name> ...]
crew files <name> ...
crew help [<command>]
crew install [-k|--keep] [-s|--build-from-source] [-v|--verbose] <name> ...
......@@ -173,6 +174,10 @@ def help (pkgName)
puts "Build package(s) from source and place the archive and checksum in the current working directory."
puts "If `-k` or `--keep` is present, the `CREW_BREW_DIR` (#{CREW_BREW_DIR}) directory will remain."
puts "If `-v` or `--verbose` is present, extra information will be displayed."
when "const"
puts "Display constant(s)."
puts "Usage: crew const [<const1> <const2> ...]"
puts "If no constants are provided, all constants will be displayed."
when "download"
puts "Download package(s)."
puts "Usage: crew download [-v|--verbose] <package1> [<package2> ...]"
......@@ -229,6 +234,36 @@ def help (pkgName)
end
end
def const (var)
if var
value = eval(var)
puts "#{var}=#{value}"
else
vars = [
'ARCH',
'ARCH_LIB',
'CHROMEOS_RELEASE',
'CREW_BREW_DIR',
'CREW_CONFIG_PATH',
'CREW_DEST_DIR',
'CREW_DEST_LIB_PREFIX',
'CREW_DEST_PREFIX',
'CREW_LIB_PATH',
'CREW_LIB_PREFIX',
'CREW_NOT_COMPRESS',
'CREW_NOT_STRIP',
'CREW_NPROC',
'CREW_PREFIX',
'CREW_VERSION',
'USER'
]
vars.each { |var|
value = eval(var)
puts "#{var}=#{value}"
}
end
end
def files (pkgName)
filelist = "#{CREW_PREFIX}/etc/crew/meta/#{pkgName}.filelist"
if File.exists? "#{filelist}"
......@@ -832,6 +867,16 @@ def download_command (args)
end
end
def const_command (args)
unless args["<name>"].empty?
args["<name>"].each do |name|
const name
end
else
const nil
end
end
def files_command (args)
args["<name>"].each do |name|
@pkgName = name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment