Commit fceda9f9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm repo set: add confirm, improve checking

parent b00ff04e
...@@ -34,6 +34,16 @@ Examples: ...@@ -34,6 +34,16 @@ Examples:
' '
} }
if_valid_reponame()
{
[ -n "$1" ] || return 1
case "$1" in
-*)
return 1
;;
esac
return 0
}
epm_repo() epm_repo()
{ {
...@@ -51,10 +61,11 @@ epm_repo() ...@@ -51,10 +61,11 @@ epm_repo()
load_helper epm-repofix load_helper epm-repofix
epm_repochange "$@" epm_repochange "$@"
;; ;;
set) # HELPCMD: <mirror>: remove all existing sources and add mirror for the branch set) # HELPCMD: <repo>: remove all existing sources and add default mirror for the branch
if [ -z "$1" ]; then if_valid_reponame "$1" || fatal "No valid repository is specified."
fatal "No repository specified." [ -n "$quiet" ] || epm repo list
fi confirm_info 'You are about to set repo ' "$*" "(all repos will be removed)."
#epm repo save
epm repo rm all epm repo rm all
epm addrepo "$@" epm addrepo "$@"
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment