Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
eepm
Commits
490013aa
Commit
490013aa
authored
Jan 23, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm search: switch to use glob symbols (not regexp)
parent
1f866b6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
epm-search
bin/epm-search
+29
-2
No files found.
bin/epm-search
View file @
490013aa
...
@@ -124,6 +124,27 @@ LANG=C docmd $CMD $string
...
@@ -124,6 +124,27 @@ LANG=C docmd $CMD $string
epm play
$short
--list-all
|
sed
-e
's|^ *||g'
-e
's|[[:space:]]\+| |g'
-e
"s|
\$
| (use
\'
epm play
\'
to install it)|"
epm play
$short
--list-all
|
sed
-e
's|^ *||g'
-e
's|[[:space:]]\+| |g'
-e
"s|
\$
| (use
\'
epm play
\'
to install it)|"
}
}
# copied from eget's filter_glob
# check man glob
__convert_glob__to_regexp
()
{
# translate glob to regexp
echo
"
$1
"
|
sed
-e
"s|
\*
|.*|g"
-e
"s|?|.|g"
}
# ^mc.*ext -> mc
_clean_from_regexp
()
{
sed
-e
"s/[?
\^
.*]/ /g"
}
# ^mc*e?t -> mc
__clean_from_glob
()
{
sed
-e
"s/[?*].*//"
-e
"s/[?
\^
.*]/ /g"
}
# produce grep sequence
# produce grep sequence
__epm_search_make_grep
()
__epm_search_make_grep
()
{
{
...
@@ -147,7 +168,7 @@ __epm_search_make_grep()
...
@@ -147,7 +168,7 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/~//g"
)
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/~//g"
)
# only apt supports regexps?
#
TODO:
only apt supports regexps?
case
$PMTYPE
in
case
$PMTYPE
in
apt-
*
)
apt-
*
)
;;
;;
...
@@ -157,6 +178,9 @@ __epm_search_make_grep()
...
@@ -157,6 +178,9 @@ __epm_search_make_grep()
;;
;;
esac
esac
list
=
$(
__convert_glob__to_regexp
"
$list
"
)
listN
=
$(
__convert_glob__to_regexp
"
$listN
"
)
if
[
-n
"
$short
"
]
;
then
if
[
-n
"
$short
"
]
;
then
echon
" | sed -e
\"
s| .*||g
\"
"
echon
" | sed -e
\"
s| .*||g
\"
"
fi
fi
...
@@ -215,9 +239,12 @@ epm_search()
...
@@ -215,9 +239,12 @@ epm_search()
warmup_bases
warmup_bases
echo
"
$*
"
|
grep
-q
"
\.
[*?]"
&&
warning
"Only glob symbols * and ? are supported. Don't use regexp here!"
# FIXME: do it better
# FIXME: do it better
local
MGS
local
MGS
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
EXTRA_SHOWDOCMD
=
"
$MGS
"
EXTRA_SHOWDOCMD
=
"
$MGS
"
eval
"__epm_search_output
\"
$(
eval
get_firstarg
$quoted_args
)
\"
$MGS
"
# TODO: use search args for more optimal output
eval
"__epm_search_output
\"
$(
eval
get_firstarg
$quoted_args
| __clean_from_glob
)
\"
$MGS
"
}
}
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