Commit 41cefa1e authored by lyxell's avatar lyxell Committed by GitHub

Merge pull request #676 from uberhacker/add-help-command

Add help command
parents edf64e5a 87b092e8
......@@ -15,7 +15,7 @@ Supported Systems
Overview
--------
Chromebooks with Chrome OS run a linux kernel - the only missing piece to use them as full-featured linux distro was gcc and make with their dependencies. Well, the piece isn't missing anymore. Say hello to chromebrew!
Chromebooks with Chrome OS run a Linux kernel. The only missing pieces to use them as full-featured Linux distro were gcc and make with their dependencies. Well, these pieces aren't missing anymore. Say hello to chromebrew!
Prerequisites
-------------
......@@ -32,7 +32,7 @@ Open the terminal with Ctrl+Alt+T and type `shell`.
If this command returns `ERROR: unknown command: shell` please have a second look at the prerequisites and make sure your Chromebook is in developer mode.
Then download and run the installation script
Then download and run the installation script below:
wget -q -O - https://raw.github.com/skycocker/chromebrew/master/install.sh | bash
......@@ -43,10 +43,15 @@ Usage
Where available commands are:
* search [looks for a package]
* download [downloads a package to `CREW_BREW_DIR` (`/usr/local/tmp/crew` by default), but doesn't install it]
* install [installs a package along with its dependencies. You'll be prompted for confirmation]
* remove [removes a package.]
* build [build a package from source and store the archive and checksum in the current working directory]
* download [download a package to `CREW_BREW_DIR` (`/usr/local/tmp/crew` by default), but don't install it]
* help [get information about command usage]
* install [install a package along with its dependencies after prompting for confirmation]
* remove [remove a package]
* search [look for a package]
* update [update crew itself]
* upgrade [update all or a specific package]
* 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).
......@@ -57,6 +62,6 @@ Chromebrew will wipe its `BREW_DIR` (`/usr/local/tmp/crew` by default) after ins
License
-------
Copyright 2013 Michal Siwek and [all the awesome contributors](https://github.com/skycocker/chromebrew/graphs/contributors)
Copyright 2013 Michal Siwek and [all the awesome contributors](https://github.com/skycocker/chromebrew/graphs/contributors).
This project including all of its source files is released under the terms of [GNU General Public License (version 3 or later)](http://www.gnu.org/licenses/gpl.txt)
This project including all of its source files is released under the terms of [GNU General Public License (version 3 or later)](http://www.gnu.org/licenses/gpl.txt).
......@@ -69,6 +69,49 @@ def search (pkgName, silent = false)
abort "package #{pkgName} not found :("
end
def help (pkgName)
case pkgName
when "build"
puts "Build a package."
puts "Usage: crew build [package]"
puts "Build [package] from source and place the archive and checksum in the current working directory."
when "download"
puts "Download a package."
puts "Usage: crew download [package]"
puts "Download [package] to `CREW_BREW_DIR` (`/usr/local/tmp/crew` by default), but don't install it."
when "install"
puts "Install a package."
puts "Usage: crew install [package]"
puts "The [package] must be a valid name. Use `crew search [package]` to search for a package to install."
when "remove"
puts "Remove a package."
puts "Usage: crew remove [package]"
puts "The [package] must be currently installed."
when "search"
puts "Look for a package."
puts "Usage: crew search [package]"
puts "If [package] is omitted, all packages will be returned. (i) in front of the name means the package is installed."
puts "Tips:"
puts " crew search | grep '(i)' will return all installed packages."
puts " crew search | grep -v '(i)' will return all available packages not already installed."
when "update"
puts "Update crew."
puts "Usage: crew update"
puts "This only updates crew itself. Use 'crew upgrade' to update packages."
when "upgrade"
puts "Update package(s)."
puts "Usage: crew upgrade [package]"
puts "If [package] is omitted, all packages will be updated. Otherwise, a specific package will be updated."
puts "Use 'crew update' to update crew itself."
when "whatprovides"
puts "Determine which package(s) contains file(s)."
puts "Usage: crew whatprovides [pattern]"
puts "The [pattern] is a search string which can contain regular expressions."
else
puts "Available commands: build, download, install, remove, search, update, upgrade, whatprovides"
end
end
def whatprovides (pkgName)
fileArray = []
Find.find (CREW_CONFIG_PATH + 'meta/') do |packageList|
......@@ -521,6 +564,13 @@ def remove (pkgName)
end
case @command
when "help"
if @pkgName
help @pkgName
else
puts "Usage: crew help [command]"
help nil
end
when "search"
if @pkgName
search @pkgName
......@@ -531,14 +581,14 @@ when "whatprovides"
if @pkgName
whatprovides @pkgName
else
puts "Usage: crew whatprovides [pattern]"
help "whatprovides"
end
when "download"
if @pkgName
search @pkgName
download
else
puts "Usage: crew download [package]"
help "download"
end
when "update"
update
......@@ -549,26 +599,26 @@ when "install"
search @pkgName
resolve_dependencies_and_install
else
puts "Usage: crew install [package]"
help "install"
end
when "build"
if @pkgName
search @pkgName
resolve_dependencies_and_build
else
puts "Usage: crew build [package]"
help "build"
end
when "remove"
if @pkgName
remove @pkgName
else
puts "Usage: crew remove [package]"
help "remove"
end
when nil
puts "Chromebrew, version 0.4.2"
puts "Usage: crew [command] [package]"
puts "Available commands: build, download, install, remove, search, update, upgrade, whatprovides"
help nil
else
puts "I have no idea how to do #{@command} :("
puts "Available commands: build, download, install, remove, search, update, upgrade, whatprovides"
help nil
end
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