Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seblu
installsystems
Commits
e289669e
Commit
e289669e
authored
13 years ago
by
Aurélien Dunand
Committed by
Seblu
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add search command
seblu: fix some code Signed-off-by:
Seblu
<
sebastien.luttringer@smartjog.com
>
parent
8b052d98
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/is
+5
-1
5 additions, 1 deletion
bin/is
installsystems/repository.py
+16
-0
16 additions, 0 deletions
installsystems/repository.py
with
21 additions
and
1 deletion
bin/is
+
5
−
1
View file @
e289669e
...
@@ -221,7 +221,10 @@ def c_search(parser, args):
...
@@ -221,7 +221,10 @@ def c_search(parser, args):
'''
'''
Search in repository
Search in repository
'''
'''
raise
NotImplementedError
(
"
Not yet implemented
"
)
repoman
=
load_repositories
(
args
)
for
repo
in
repoman
:
arrow
(
repo
.
config
.
name
)
repo
.
search
(
args
.
pattern
)
def
c_get
(
parser
,
args
):
def
c_get
(
parser
,
args
):
'''
'''
...
@@ -351,6 +354,7 @@ p_cat.set_defaults(func=c_cat)
...
@@ -351,6 +354,7 @@ p_cat.set_defaults(func=c_cat)
# search command parser
# search command parser
p_search
=
subparsers
.
add_parser
(
"
search
"
,
help
=
c_search
.
__doc__
.
lower
())
p_search
=
subparsers
.
add_parser
(
"
search
"
,
help
=
c_search
.
__doc__
.
lower
())
p_search
.
add_argument
(
"
pattern
"
,
help
=
"
search pattern in repository
"
)
p_search
.
set_defaults
(
func
=
c_search
)
p_search
.
set_defaults
(
func
=
c_search
)
# get command parser
# get command parser
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
16
−
0
View file @
e289669e
...
@@ -202,6 +202,22 @@ class Repository(object):
...
@@ -202,6 +202,22 @@ class Repository(object):
out
(
'
#yellow#MD5:#reset# %s
'
%
payload_md5
)
out
(
'
#yellow#MD5:#reset# %s
'
%
payload_md5
)
out
()
out
()
def
search
(
self
,
pattern
):
'''
Search pattern in a repository
'''
images
=
self
.
db
.
ask
(
"
SELECT name, version, author, description
\
FROM image
\
WHERE name LIKE ? OR
\
description LIKE ? OR
\
author LIKE ?
"
,
tuple
(
[
"
%%%s%%
"
%
pattern
]
*
3
)
).
fetchall
()
for
name
,
version
,
author
,
description
in
images
:
arrow
(
"
%s v%s
"
%
(
name
,
version
),
1
)
out
(
"
#yellow#Author:#reset# %s
"
%
author
)
out
(
"
#yellow#Description:#reset# %s
"
%
description
)
def
_remove_file
(
self
,
filename
):
def
_remove_file
(
self
,
filename
):
'''
'''
Remove a filename from pool. Check if it
'
s not needed by db before
Remove a filename from pool. Check if it
'
s not needed by db before
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment