Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
nexedi
chromebrew
Commits
73bb7654
Commit
73bb7654
authored
7 years ago
by
Philippe Dagenais
Committed by
Ed Reel
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add list command to crew (#2151)
parent
13ba0ccf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
crew
crew
+36
-2
No files found.
crew
View file @
73bb7654
...
...
@@ -25,6 +25,7 @@ Usage:
crew
files
<
name
>
...
crew
help
[<
command
>]
crew
install
[-
k
|--
keep
]
[-
s
|--
build
-
from
-
source
]
[-
v
|--
verbose
]
<
name
>
...
crew
list
(
available
|
installed
)
crew
remove
[-
v
|--
verbose
]
<
name
>
...
crew
search
[-
v
|--
verbose
]
[<
name
>
...]
crew
update
...
...
@@ -60,7 +61,7 @@ rescue Docopt::Exit => e
end
if
ARGV
[
0
]
!= '-h' and ARGV[0] != '--help' then
puts
"Could not understand
\"
crew #{ARGV.join(' ')}
\"
."
.
lightred
cmds
=
[
"build"
,
"download"
,
"files"
,
"help"
,
"install"
,
"remove"
,
"search"
,
"update"
,
"upgrade"
,
"whatprovides"
]
cmds
=
[
"build"
,
"download"
,
"files"
,
"help"
,
"install"
,
"list"
,
"remove"
,
"search"
,
"update"
,
"upgrade"
,
"whatprovides"
]
#
Looking
for
similar
commands
if
not
cmds
.
include
?(
ARGV
[
0
])
then
similar
=
cmds
.
select
{|
word
|
edit_distance
(
ARGV
[
0
],
word
)
<
4
}
...
...
@@ -115,6 +116,28 @@ def list_packages
end
end
def
list_available
Find
.
find
(
CREW_LIB_PATH
+
'packages'
)
do
|
filename
|
@
notInstalled
=
true
Find
.
find
(
CREW_CONFIG_PATH
+
'meta/'
)
do
|
packageList
|
packageName
=
File
.
basename
filename
,
'.rb'
@
notInstalled
=
nil
if
packageList
==
CREW_CONFIG_PATH
+
'meta/'
+
packageName
+
'.filelist'
end
puts
File
.
basename
filename
,
'.rb'
if
File
.
extname
(
filename
)
==
'.rb'
if
@
notInstalled
end
end
def
list_installed
Find
.
find
(
CREW_LIB_PATH
+
'packages'
)
do
|
filename
|
Find
.
find
(
CREW_CONFIG_PATH
+
'meta/'
)
do
|
packageList
|
packageName
=
File
.
basename
filename
,
'.rb'
if
packageList
==
CREW_CONFIG_PATH
+
'meta/'
+
packageName
+
'.filelist'
puts
File
.
basename
filename
,
'.rb'
if
File
.
extname
(
filename
)
==
'.rb'
end
end
end
end
def
search
(
pkgName
,
silent
=
false
)
Find
.
find
(
CREW_LIB_PATH
+
'packages'
)
do
|
filename
|
return
set_package
(
pkgName
,
silent
)
if
filename
==
CREW_LIB_PATH
+
'packages/'
+
pkgName
+
'.rb'
...
...
@@ -166,6 +189,9 @@ def help (pkgName)
puts
"If `-k` or `--keep` is present, the `CREW_BREW_DIR` (#{CREW_BREW_DIR}) directory will remain."
puts
"If `-s` or `--build-from-source` is present, the package(s) will be compiled instead of installed via binary."
puts
"If `-v` or `--verbose` is present, extra information will be displayed."
when
"list"
puts
"List available or installed packages"
puts
"Usage: crew list (available|installed)"
when
"remove"
puts
"Remove package(s)."
puts
"Usage: crew remove [-v|--verbose] <package1> [<package2> ...]"
...
...
@@ -199,7 +225,7 @@ def help (pkgName)
puts
"Usage: crew whatprovides <pattern> ..."
puts
"The <pattern> is a search string which can contain regular expressions."
else
puts
"Available commands: build, download, files, install, remove, search, update, upgrade, whatprovides"
puts
"Available commands: build, download, files, install,
list ,
remove, search, update, upgrade, whatprovides"
end
end
...
...
@@ -820,6 +846,14 @@ def install_command (args)
end
end
def
list_command
(
args
)
if
args
[
'available'
]
list_available
elsif
args
[
'installed'
]
list_installed
end
end
def
remove_command
(
args
)
args
[
"<name>"
].
each
do
|
name
|
remove
name
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment