Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
- Update readme
- Split “list” into “list” and “listall”
- Kill short option names
- Kill --file option
- Kill --help option
  • Loading branch information
Steven Penny committed Apr 18, 2015
1 parent 27570ba commit 3ca57e8
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 133 deletions.
115 changes: 51 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,57 @@ apt-cyg
apt-cyg is a Cygwin package manager. It includes a command-line installer for
Cygwin which cooperates with Cygwin Setup and uses the same repository.

<table>
<thead>
<tr>
<th>Command</th>
<th>Description</th>
<th>Analog</th>
</tr>
</thead>
<tbody>
<tr>
<td>install</td>
<td>Install packages</td>
<td>apt-get install</td>
</tr>
<tr>
<td>remove</td>
<td>Remove packages</td>
<td>apt-get&nbsp;remove</td>
</tr>
<tr>
<td>update</td>
<td>Update setup.ini</td>
<td>apt-get&nbsp;update</td>
</tr>
<tr>
<td>show</td>
<td>Displays the package records for the named packages</td>
<td>apt-cache&nbsp;show</td>
</tr>
<tr>
<td>list</td>
<td>
List packages matching given pattern. If no pattern is given, list all installed
packages.
</td>
<td>dpkg --list</td>
</tr>
<tr>
<td>search</td>
<td>Search for a filename from installed packages</td>
<td>dpkg --search</td>
</tr>
<tr>
<td>download</td>
<td>Download only - do NOT install or unpack archives</td>
<td>apt-get&nbsp;install&nbsp;--download-only</td>
</tr>
<tr>
<td>depends</td>
<td>Performs recursive dependency listings</td>
<td>apt-cache depends</td>
</tr>
<tr>
<td>listfiles</td>
<td>List files owned by packages</td>
<td>dpkg --listfiles</td>
</tr>
<tr>
<td>searchall</td>
<td>Search for a filename from all available packages</td>
<td>apt-file search</td>
</tr>
</tbody>
</table>
Operations
----------

~~~
install
Install package(s).
remove
Remove package(s) from the system.
update
Download a fresh copy of the master package list (setup.ini) from the
server defined in setup.rc.
download
Retrieve package(s) from the server, but do not install/upgrade anything.
show
Display information on given package(s).
depends
Produce a dependency tree for a package.
rdepends
Produce a tree of packages that depend on the named package.
list
Search each locally-installed package for names that match regexp. If no
package names are provided in the command line, all installed packages will
be queried.
listall
This will search each package in the master package list (setup.ini) for
names that match regexp.
category
Display all packages that are members of a named category.
listfiles
List all files owned by a given package. Multiple packages can be specified
on the command line.
search
Search for downloaded packages that own the specified file(s). The path can
be relative or absolute, and one or more files can be specified.
searchall
Search cygwin.com to retrieve file information about packages. The provided
target is considered to be a filename and searchall will return the
package(s) which contain this file.
~~~

Quick start
-----------
Expand Down
165 changes: 96 additions & 69 deletions apt-cyg
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,83 @@
# THE SOFTWARE.

mapfile usage <<+
usage: apt-cyg [command] [options] [packages]
Commands:
install Install packages
remove Remove packages
update Update setup.ini
download Download only - do NOT install or unpack archives
show Displays the package records for the named packages
depends Performs recursive dependency listings
rdepends Display packages which require X to be installed,
AKA show reverse dependencies
list List packages matching given pattern. If no pattern is given,
list all installed packages.
category List packages matching given category
listfiles List files owned by packages
search Search for a filename from installed packages
searchall Search for a filename from all available packages
Options:
-c, --cache <dir> set cache
-f, --file <file> read package names from file
-m, --mirror <url> set mirror
--help
--version
NAME
apt-cyg - package manager utility
SYNOPSIS
apt-cyg [operation] [options] [targets]
DESCRIPTION
apt-cyg is a package management utility that tracks installed packages on a
Cygwin system. Invoking apt-cyg involves specifiying an operation with any
potential options and targets to operate on. A target is usually a package
name, file name, or a search string. Targets can be provided as command line
arguments.
OPERATIONS
install
Install package(s).
remove
Remove package(s) from the system.
update
Download a fresh copy of the master package list (setup.ini) from the
server defined in setup.rc.
download
Retrieve package(s) from the server, but do not install/upgrade anything.
show
Display information on given package(s).
depends
Produce a dependency tree for a package.
rdepends
Produce a tree of packages that depend on the named package.
list
Search each locally-installed package for names that match regexp. If no
package names are provided in the command line, all installed packages will
be queried.
listall
This will search each package in the master package list (setup.ini) for
names that match regexp.
category
Display all packages that are members of a named category.
listfiles
List all files owned by a given package. Multiple packages can be specified
on the command line.
search
Search for downloaded packages that own the specified file(s). The path can
be relative or absolute, and one or more files can be specified.
searchall
Search cygwin.com to retrieve file information about packages. The provided
target is considered to be a filename and searchall will return the
package(s) which contain this file.
OPTIONS
--nodeps
Specify this option to skip all dependency checks.
--mirror <url>
A full URL to a location where the database, packages, and signatures for
this repository can be found.
--cache <dir>
Overrides the default location of the package cache directory. A typical
default is C:\Users\John\Downloads. If a file is not found in the cache
directory, it will be downloaded. NOTE: this is an absolute path, the root
path is not automatically prepended.
--version
Display version and exit.
+

mapfile version <<+
Expand Down Expand Up @@ -124,7 +177,7 @@ function check-packages {
then
return 0
else
echo No packages found
echo No packages found.
return 1
fi
}
Expand Down Expand Up @@ -161,22 +214,27 @@ function apt-category {
}

function apt-list {
find-workspace
local sbq
for pkg in "${pks[@]}"
do
(( sbq++ )) && echo
info Searching for installed packages matching "$pkg":
awk 'NR>1 && $1~ENVIRON["pkg"] && $0=$1' /etc/setup/installed.db
echo
info Searching for installable packages matching "$pkg":
awk '$1 ~ ENVIRON["pkg"] && $0 = $1' RS='\n\n@ ' FS='\n' setup.ini
let sbq++ && echo
awk 'NR>1 && $1~pkg && $0=$1' pkg="$pkg" /etc/setup/installed.db
done
(( sbq )) && return
info The following packages are installed:
let sbq && return
awk 'NR>1 && $0=$1' /etc/setup/installed.db
}

function apt-listall {
check-packages
find-workspace
local sbq
for pkg in "${pks[@]}"
do
let sbq++ && echo
awk '$1~pkg && $0=$1' RS='\n\n@ ' FS='\n' pkg="$pkg" setup.ini
done
}

function apt-listfiles {
check-packages
find-workspace
Expand Down Expand Up @@ -521,7 +579,7 @@ while (( $# ))
do
case "$1" in

--mirror | -m)
--mirror)
awk -i inplace '
1
/last-mirror/ {
Expand All @@ -532,7 +590,7 @@ do
shift 2
;;

--cache | -c)
--cache)
rpc=$(cygpath -aw "$2" | sed 's \\ \\\\ g')
awk -i inplace '
1
Expand All @@ -549,49 +607,18 @@ do
shift
;;

--help)
printf %s "${usage[@]}"
exit 0
;;

--version)
printf %s "${version[@]}"
exit 0
;;

--file | -f)
if [[ $2 ]]
then
mf=$2
if [ -f "$mf" ]
then
mapfile -t pks < "$mf"
else
echo File "$mf" not found, skipping
fi
shift
else
info No file name provided, ignoring $1
fi
shift
;;

update)
command=$1
shift
;;

install \
| remove \
| download \
| show \
| depends \
| rdepends \
| list \
| category \
| listfiles \
| search \
| searchall)
list | remove | depends | listall | download | listfiles |\
show | search | install | category | rdepends | searchall )
if [[ $command ]]
then
pks+=("$1")
Expand Down

0 comments on commit 3ca57e8

Please sign in to comment.