File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ void DownloadCommand::set_argument_parser() {
158158 cmd.register_named_arg (resolve);
159159 cmd.register_named_arg (alldeps);
160160 create_destdir_option (*this );
161+ auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this );
161162 cmd.register_named_arg (srpm);
162163 cmd.register_named_arg (url);
163164 cmd.register_named_arg (urlprotocol);
@@ -212,6 +213,14 @@ void DownloadCommand::run() {
212213 pkg_query.filter_arch (std::vector<std::string>(arch_option.begin (), arch_option.end ()));
213214 }
214215
216+ if (!pkg_query.size () && !ctx.get_base ().get_config ().get_skip_unavailable_option ().get_value ()) {
217+ // User tried `dnf5 download non-sense` or `dnf download non-sense-wildcard*`
218+ throw libdnf5::cli::CommandExitError (
219+ 1 ,
220+ M_ (" No package \" {}\" available; You might want to use --skip-unavailable option." ),
221+ option->get_value ());
222+ }
223+
215224 for (const auto & pkg : pkg_query) {
216225 download_pkgs.insert (create_nevra_pkg_pair (pkg));
217226
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ Options
5050``--destdir=<path> ``
5151 | Set directory used for downloading packages to. Default location is to the current working directory.
5252
53+ ``--skip-unavailable ``
54+ | Allow skipping packages that are not available in repositories. All available packages will be downloaded.
55+
5356``--srpm ``
5457 | Download the source rpm. Enables source repositories of all enabled binary repositories.
5558
You can’t perform that action at this time.
0 commit comments