mirror of
https://github.com/Jguer/yay
synced 2024-10-07 00:29:10 +00:00
add option/setting "AurRpcUrl" (#1809)
Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
7f9ac3435f
commit
647d160182
1
cmd.go
1
cmd.go
|
@ -59,6 +59,7 @@ Permanent configuration options:
|
|||
config file when used
|
||||
|
||||
--aururl <url> Set an alternative AUR URL
|
||||
--aurrpcurl <url> Set an alternative URL for the AUR /rpc endpoint
|
||||
--builddir <dir> Directory used to download and run PKGBUILDS
|
||||
--editor <file> Editor to use when editing PKGBUILDs
|
||||
--editorflags <flags> Pass arguments to editor
|
||||
|
|
|
@ -75,7 +75,7 @@ _yay() {
|
|||
noansweredit noanswerupgrade cleanmenu diffmenu editmenu upgrademenu cleanafter nocleanafter
|
||||
nocleanmenu nodiffmenu noupgrademenu provides noprovides pgpfetch nopgpfetch
|
||||
useask nouseask combinedupgrade nocombinedupgrade aur repo makepkgconf
|
||||
nomakepkgconf askremovemake removemake noremovemake completioninterval aururl
|
||||
nomakepkgconf askremovemake removemake noremovemake completioninterval aururl aurrpcurl
|
||||
searchby batchinstall nobatchinstall'
|
||||
'b d h q r v')
|
||||
yays=('clean gendb' 'c')
|
||||
|
|
|
@ -189,6 +189,7 @@ complete -c $progname -n "$getpkgbuild" -s p -l print -d 'Print pkgbuild of pack
|
|||
# Permanent configuration settings
|
||||
complete -c $progname -n "not $noopt" -l save -d 'Save current arguments to yay permanent configuration' -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 builddir -d 'Directory to use for Building AUR Packages' -r
|
||||
complete -c $progname -n "not $noopt" -l editor -d 'Editor to use' -f
|
||||
complete -c $progname -n "not $noopt" -l editorflags -d 'Editor flags to use' -f
|
||||
|
|
|
@ -26,6 +26,7 @@ _pacman_opts_common=(
|
|||
'--repo[Assume targets are from the repositories]'
|
||||
{-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'
|
||||
'--arch[Set an alternate architecture]'
|
||||
{-b,--dbpath}'[Alternate database location]:database_location:_files -/'
|
||||
'--color[colorize the output]:color options:(always never auto)'
|
||||
|
|
|
@ -161,6 +161,10 @@ file.
|
|||
.B \-\-aururl
|
||||
Set an alternative AUR URL.
|
||||
|
||||
.TP
|
||||
.B \-\-aurrpcurl
|
||||
Set an alternative URL for the AUR /rpc endpoint.
|
||||
|
||||
.TP
|
||||
.B \-\-builddir <dir>
|
||||
Directory to use for Building AUR Packages. This directory is also used as
|
||||
|
|
|
@ -27,14 +27,29 @@ func (c *Configuration) extractYayOptions(a *parser.Arguments) {
|
|||
}
|
||||
}
|
||||
|
||||
c.Runtime.AURClient.BaseURL = strings.TrimRight(c.AURURL, "/") + "/rpc?"
|
||||
c.AURURL = strings.TrimRight(c.AURURL, "/")
|
||||
c.Runtime.AURClient.BaseURL = c.AURURL + "/rpc?"
|
||||
|
||||
// if AurRPCURL is set, use that for /rpc calls
|
||||
if c.AURRPCURL != "" {
|
||||
if !strings.HasSuffix(c.AURRPCURL, "?") {
|
||||
if strings.HasSuffix(c.AURRPCURL, "/rpc") {
|
||||
c.AURRPCURL += "?"
|
||||
} else {
|
||||
c.AURRPCURL = strings.TrimRight(c.AURRPCURL, "/") + "/rpc?"
|
||||
}
|
||||
}
|
||||
|
||||
c.Runtime.AURClient.BaseURL = c.AURRPCURL
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Configuration) handleOption(option, value string) bool {
|
||||
switch option {
|
||||
case "aururl":
|
||||
c.AURURL = value
|
||||
case "aurrpcurl":
|
||||
c.AURRPCURL = value
|
||||
case "save":
|
||||
c.Runtime.SaveConfig = true
|
||||
case "afterclean", "cleanafter":
|
||||
|
|
|
@ -31,6 +31,7 @@ var NoConfirm = false
|
|||
// Configuration stores yay's config.
|
||||
type Configuration struct {
|
||||
AURURL string `json:"aururl"`
|
||||
AURRPCURL string `json:"aurrpcurl"`
|
||||
BuildDir string `json:"buildDir"`
|
||||
Editor string `json:"editor"`
|
||||
EditorFlags string `json:"editorflags"`
|
||||
|
@ -110,6 +111,7 @@ func (c *Configuration) Save(configPath string) error {
|
|||
|
||||
func (c *Configuration) expandEnv() {
|
||||
c.AURURL = os.ExpandEnv(c.AURURL)
|
||||
c.AURRPCURL = os.ExpandEnv(c.AURRPCURL)
|
||||
c.BuildDir = os.ExpandEnv(c.BuildDir)
|
||||
c.Editor = os.ExpandEnv(c.Editor)
|
||||
c.EditorFlags = os.ExpandEnv(c.EditorFlags)
|
||||
|
|
|
@ -373,6 +373,7 @@ func isArg(arg string) bool {
|
|||
case "machinereadable":
|
||||
// yay options
|
||||
case "aururl":
|
||||
case "aurrpcurl":
|
||||
case "save":
|
||||
case "afterclean", "cleanafter":
|
||||
case "noafterclean", "nocleanafter":
|
||||
|
@ -520,6 +521,7 @@ func hasParam(arg string) bool {
|
|||
case "color":
|
||||
// yay params
|
||||
case "aururl":
|
||||
case "aurrpcurl":
|
||||
case "mflags":
|
||||
case "gpgflags":
|
||||
case "gitflags":
|
||||
|
|
Loading…
Reference in a new issue