Merge pull request #486 from Morganamilo/doc3

Add flags for diff and upgrade to match the rest and document it all
This commit is contained in:
Anna 2018-06-11 20:14:50 +01:00 committed by GitHub
commit 14eaf467a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 112 additions and 11 deletions

20
cmd.go
View File

@ -58,11 +58,21 @@ Permanent configuration options:
--requestsplitn <n> Max amount of packages to query per AUR request
--sortby <field> Sort AUR results by a specific field during search
--answerclean <a> Set a predetermined answer for the clean build menu
--answerdiff <a> Set a predetermined answer for the diff menu
--answeredit <a> Set a predetermined answer for the edit pkgbuild menu
--answerupgrade <a> Set a predetermined answer for the upgrade menu
--noanswerclean Unset the answer for the clean build menu
--noanswerdiff Unset the answer for the edit diff menu
--noansweredit Unset the answer for the edit pkgbuild menu
--noanswerupgrade Unset the answer for the upgrade menu
--cleanmenu Give the option to clean build PKGBUILDS
--diffmenu Give the option to show diffs for build files
--editmenu Give the option to edit/view PKGBUILDS
--upgrademenu Show a detailed list of updates with the option to skip any
--nocleanmenu Don't clean build PKGBUILDS
--nodiffmenu Don't show diffs for build files
--noeditmenu Don't edit/view PKGBUILDS
--noupgrademenu Don't show the upgrade menu
--afterclean Remove package sources after successful install
--noafterclean Do not remove package sources after successful build
@ -73,8 +83,6 @@ Permanent configuration options:
--nodevel Do not check development packages
--gitclone Use git clone for PKGBUILD retrieval
--nogitclone Never use git clone for PKGBUILD retrieval
--showdiffs Show diffs for build files
--noshowdiffs Always show the entire PKGBUILD
--rebuild Always build target packages
--rebuildall Always build all AUR packages
--norebuild Skip package build if in cache and up to date
@ -262,6 +270,10 @@ func handleConfig(option, value string) bool {
config.AnswerClean = value
case "noanswerclean":
config.AnswerClean = ""
case "answerdiff":
config.AnswerDiff = value
case "noanswerdiff":
config.AnswerDiff = ""
case "answeredit":
config.AnswerEdit = value
case "noansweredit":
@ -313,6 +325,10 @@ func handleConfig(option, value string) bool {
config.PGPFetch = true
case "nopgpfetch":
config.PGPFetch = false
case "upgrademenu":
config.UpgradeMenu = true
case "noupgrademenu":
config.UpgradeMenu = false
case "cleanmenu":
config.CleanMenu = true
case "nocleanmenu":

View File

@ -45,6 +45,7 @@ type Configuration struct {
ReDownload string `json:"redownload"`
ReBuild string `json:"rebuild"`
AnswerClean string `json:"answerclean"`
AnswerDiff string `json:"answerdiff"`
AnswerEdit string `json:"answeredit"`
AnswerUpgrade string `json:"answerupgrade"`
GitBin string `json:"gitbin"`
@ -65,6 +66,7 @@ type Configuration struct {
Provides bool `json:"provides"`
PGPFetch bool `json:"pgpfetch"`
ShowDiffs bool `json:"showdifs"`
UpgradeMenu bool `json:"upgrademenu"`
CleanMenu bool `json:"cleanmenu"`
DiffMenu bool `json:"diffmenu"`
EditMenu bool `json:"editmenu"`
@ -167,10 +169,12 @@ func defaultSettings(config *Configuration) {
config.ReDownload = "no"
config.ReBuild = "no"
config.AnswerClean = ""
config.AnswerDiff = ""
config.AnswerEdit = ""
config.AnswerUpgrade = ""
config.GitClone = true
config.Provides = true
config.UpgradeMenu = true
config.CleanMenu = true
config.DiffMenu = true
config.EditMenu = false

View File

@ -232,6 +232,13 @@ will be used instead of reading from standard input but will be treated exactly
the same when parsed\&.
.RE
.PP
\fB\-\-answerdiff <All|None|Installed|NotInstalled|...>\fR
.RS 4
Set a predetermined answer for the edit diff menu question\&. This answer
will be used instead of reading from standard input but will be treated exactly
the same when parsed\&.
.RE
.PP
\fB\-\-answeredit <All|None|Installed|NotInstalled|...>\fR
.RS 4
Set a predetermined answer for the edit pkgbuild menu question\&. This answer
@ -251,6 +258,11 @@ reading from standard input but will be treated exactly the same\&.
Unset the answer for the clean build menu\&.
.RE
.PP
\fB\-\-noanswerdiff\fR
.RS 4
Unset the answer for the diff menu\&.
.RE
.PP
\fB\-\-noansweredit\fR
.RS 4
Unset the answer for the edit pkgbuild menu\&.
@ -261,6 +273,59 @@ Unset the answer for the edit pkgbuild menu\&.
Unset the answer for the upgrade menu\&.
.RE
.PP
\fB\-\-cleanmenu\fR
.RS 4
Show the clean menu\&. This menu gives you the chance to fully delete the
downloaded build files from Yay's cache before redownloing a fresh copy\&.
.RE
.PP
\fB\-\-diffmenu\fR
.RS 4
Show the diff menu\&. This menu gives you the option to view diffs from
build files before building\&.
.RE
.PP
\fB\-\-editmenu\fR
.RS 4
Show the edit menu\&. This menu gives you the option to edit or view PKGBUILDs
before building\&.
\fBWarning\fR: Yay resolves dependencies ahead of time via the RPC\&. It is not
recommended to edit pkgbuild variables unless you know what you are doing\&.
.RE
.PP
\fB\-\-upgrademenu\fR
.RS 4
Show a detailed list of updates in a similar format to VerbosePkgLists\&.
Upgrades can also be skipped using numbers, number ranges or repo names\&.
Adidionally ^ can be used to invert the selection\&.
\fBWarning\fR: It is not recommended to skip updates from the repositores as
this can lead to partial upgrades\&. This feature is intended to easily skip AUR
updates on the fly that may be broken or have a long compile time\&. Ultimately
it is up to the user what upgrades they skip\&.
.RE
.PP
\fB\-\-nocleanmenu\fR
.RS 4
Do not show the clean menu\&.
.RE
.PP
\fB\-\-nodiffmenu\fR
.RS 4
Do not show the diff menu\&.
.RE
.PP
\fB\-\-noeditmenu\fR
.RS 4
Do not show the edit menu\&.
.RE
.PP
\fB\-\-noupgrademenu\fR
.RS 4
Do not show the upgrade menu\&.
.RE
.PP
\fB\-\-topdown\fR
.RS 4
Display repository packages first and then AUR packages\&.

View File

@ -104,7 +104,7 @@ func install(parser *arguments) error {
if err != nil {
return err
}
if len(dp.Aur) == 0 {
parser.op = "S"
parser.delArg("y", "refresh")
@ -477,19 +477,25 @@ func diffNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stri
func editDiffNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet, diff bool) ([]*rpc.Pkg, error) {
toEdit := make([]*rpc.Pkg, 0)
var editInput string
var err error
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))
if diff {
fmt.Println(bold(green(arrow + " Diffs to show?")))
fmt.Print(bold(green(arrow + " ")))
editInput, err = getInput(config.AnswerDiff)
if err != nil {
return nil, err
}
} else {
fmt.Println(bold(green(arrow + " PKGBUILDs to edit?")))
}
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))
fmt.Print(bold(green(arrow + " ")))
editInput, err := getInput(config.AnswerEdit)
if err != nil {
return nil, err
fmt.Print(bold(green(arrow + " ")))
editInput, err = getInput(config.AnswerEdit)
if err != nil {
return nil, err
}
}
eInclude, eExclude, eOtherInclude, eOtherExclude := parseNumberMenu(editInput)

View File

@ -469,6 +469,8 @@ func hasParam(arg string) bool {
return true
case "answerclean":
return true
case "answerdiff":
return true
case "answeredit":
return true
case "answerupgrade":

View File

@ -343,6 +343,14 @@ func upgradePkgs(aurUp, repoUp upSlice) (stringSet, stringSet, error) {
return ignore, aurNames, nil
}
if !config.UpgradeMenu {
for _, pkg := range aurUp {
aurNames.set(pkg.Name)
}
return ignore, aurNames, nil
}
sort.Sort(repoUp)
sort.Sort(aurUp)
allUp := append(repoUp, aurUp...)