Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion completions/bash
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ _paru() {
common=('arch cachedir color config confirm dbpath debug gpgdir help hookdir logfile
noconfirm noprogressbar noscriptlet quiet root verbose

repo aur aururl clonedir makepkg mflags pacman pacman-conf git gitflags sudo sudoflags
repo aur aururl newsurl clonedir makepkg mflags pacman pacman-conf git gitflags sudo sudoflags
asp gpg gpgflags fm fmflags chrootflags pager completioninterval sortby searchby limit
upgrademenu removemake noremovemake cleanafter nocleanafter rebuild rebuildall norebuild
rebuildtree redownload noredownload redownloadall pgpfetch nopgpfetch useask
Expand Down
1 change: 1 addition & 0 deletions completions/fish
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ complete -c $progname -n "not $noopt" -l repo -d 'Assume targets are from the re
complete -c $progname -n "not $noopt" -s a -l aur -d 'Assume targets are from the AUR' -f
complete -c $progname -n "not $noopt" -l aururl -d 'Set an alternative AUR URL' -f
complete -c $progname -n "not $noopt" -l aurrpcurl -d 'Set an alternative URL for the AUR /rpc endpoint' -f
complete -c $progname -n "not $noopt" -l newsurl -d 'Set an alternative URL for the news feed' -f
complete -c $progname -n "not $noopt" -l clonedir -d 'Directory used to download and run PKGBUILDs' -r
complete -c $progname -n "not $noopt" -l makepkg -d 'Makepkg command to use' -f
complete -c $progname -n "not $noopt" -l pacman -d 'Pacman command to use' -f
Expand Down
1 change: 1 addition & 0 deletions completions/zsh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ _pacman_opts_common=(
{-a,--aur}'[Assume targets are from the AUR]'
'--aururl[Set an alternative AUR URL]:url'
'--aurrpcurl[Set an alternative URL for the AUR /rpc endpoint]:url'
'--newsurl[Set an alternative URL for the news feed]:url'

'--clonedir[Directory used to download and run PKGBUILDs]:build dir:_files -/'
'--makepkg[makepkg command to use]:makepkg:_files'
Expand Down
4 changes: 4 additions & 0 deletions man/paru.8
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ gpg config\%.
.B \-\-newsonupgrade
Print new news during sysupgrade.

.TP
.B \-\-newsurl <url>
Set an alternative URL for the news feed. Defaults to the Arch Linux news feed.

.TP
.B \-\-useask
Use pacman's --ask flag to automatically confirm package conflicts. Paru lists
Expand Down
4 changes: 4 additions & 0 deletions man/paru.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ another package, install all the packages in the install queue.
.B NewsOnUpgrade
Print new news during sysupgrade.

.TP
.B NewsUrl = URL
URL of the RSS/Atom feed to fetch news from. Defaults to the Arch Linux news feed.

.TP
.B UseAsk
Use pacman's --ask flag to automatically confirm package conflicts. Paru lists
Expand Down
2 changes: 2 additions & 0 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ impl Config {
Arg::Long("print") | Arg::Short('p') => self.print = true,
Arg::Long("newsonupgrade") => self.news_on_upgrade = true,
Arg::Long("nonewsonupgrade") => self.news_on_upgrade = false,
Arg::Long("newsurl") => self.news_url = Some(value?.parse()?),
Arg::Long("comments") => self.comments += 1,
Arg::Long("ssh") => self.ssh = true,
Arg::Long("failfast") => self.fail_fast = true,
Expand Down Expand Up @@ -424,6 +425,7 @@ fn takes_value(arg: Arg) -> TakesValue {
Arg::Long("redownload") => TakesValue::Optional,
Arg::Long("rebuild") => TakesValue::Optional,
Arg::Long("sudoloop") => TakesValue::Optional,
Arg::Long("newsurl") => TakesValue::Required,
Arg::Long("develsuffixes") => TakesValue::Required,
Arg::Long("localrepo") => TakesValue::Optional,
Arg::Long("chroot") => TakesValue::Optional,
Expand Down
7 changes: 7 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ pub struct Config {
pub aur_rpc_url: Option<Url>,
#[default(Url::parse("https://archlinux.org").unwrap())]
pub arch_url: Url,
pub news_url: Option<Url>,
pub build_dir: PathBuf,
pub cache_dir: PathBuf,
pub state_dir: PathBuf,
Expand Down Expand Up @@ -1062,6 +1063,12 @@ then initialise it with:
"SaveChanges" => self.save_changes = true,
"NewsOnUpgrade" => self.news_on_upgrade = true,
"InstallDebug" => self.install_debug = true,
"NewsUrl" => {
self.news_url = Some(value.ok_or_else(|| anyhow!(tr!(
"value can not be empty for key '{}'",
key
)))?.parse()?)
}
"Redownload" => self.redownload = YesNoAll::Yes.default_or(key, value)?,
"Rebuild" => self.rebuild = YesNoAllTree::Yes.default_or(key, value)?,
"RemoveMake" => self.remove_make = YesNoAsk::Yes.default_or(key, value)?,
Expand Down
1 change: 1 addition & 0 deletions src/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub fn help() {
);
printtr!(" --aururl <url> Set an alternative AUR URL");
printtr!(" --aurrpcur <url> Set an alternative URL for the AUR /rpc endpoint");
printtr!(" --newsurl <url> Set an alternative URL for the news feed");
printtr!(" --clonedir <dir> Directory used to download and run PKGBUILDs");
println!();
printtr!(" --makepkg <file> makepkg command to use");
Expand Down
12 changes: 10 additions & 2 deletions src/news.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ pub fn newest_pkg(config: &Config) -> i64 {
}

pub async fn news(config: &Config) -> Result<i32> {
let url = config.arch_url.join("feeds/news")?;
let url = config
.news_url
.clone()
.unwrap_or(config.arch_url.join("feeds/news")?);
let client = config.raur.client();

let resp = client.get(url.clone()).send().await?;
Expand Down Expand Up @@ -62,7 +65,12 @@ pub async fn news(config: &Config) -> Result<i32> {
println!("{}", c.bold.paint(title));

printed = true;
parse_html(config, item.description().unwrap_or_default());
let content = item
.content()
.filter(|s| !s.is_empty())
.or(item.description())
.unwrap_or_default();
parse_html(config, content);
}

if !printed {
Expand Down