Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chromebrew
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Hervier
chromebrew
Commits
73bb7654
Commit
73bb7654
authored
Mar 24, 2018
by
Philippe Dagenais
Committed by
Ed Reel
Mar 24, 2018
Browse files
Options
Browse Files
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
...
...
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