References #64. Added optional afterclean. Updates man page. Adds entries to --help

This commit is contained in:
Jguer 2017-12-04 11:39:23 +09:00
parent 22931a77a3
commit 4c7f341dd2
No known key found for this signature in database
GPG key ID: 09754DBECF21746F
4 changed files with 137 additions and 84 deletions

20
cmd.go
View file

@ -31,12 +31,20 @@ func usage() {
yay -G [package(s)] get pkgbuild from ABS or AUR
yay --gendb generates development package DB used for updating.
New options:
Permanent configuration options:
--topdown shows repository's packages first and then aur's
--bottomup shows aur's packages first and then repository's
--noconfirm skip user input on package install
--devel Check -git/-svn/-hg development version
--nodevel Disable development version checking`)
--nodevel Disable development version checking
--afterclean Clean package sources after successful build
--noafterclean Disable package sources cleaning after successful build
--timeupdate Check package's modification date and version
--notimeupdate Check only package version change
New options:
--noconfirm skip user input on package install
--printconfig Prints current yay configuration
`)
}
func init() {
@ -155,8 +163,12 @@ func parser() (op string, options []string, packages []string, changedConfig boo
if strings.HasPrefix(arg, "--") {
changedConfig = true
switch arg {
case "--afterclean":
config.CleanAfter = true
case "--noafterclean":
config.CleanAfter = false
case "--printconfig":
fmt.Printf("%+v", config)
fmt.Printf("%#v", config)
os.Exit(0)
case "--gendb":
err = createDevelDB()

View file

@ -27,6 +27,7 @@ const (
// Configuration stores yay's config.
type Configuration struct {
BuildDir string `json:"buildDir"`
CleanAfter bool `json:"cleanAfter"`
Editor string `json:"editor"`
MakepkgBin string `json:"makepkgbin"`
Shell string `json:"-"`
@ -41,7 +42,7 @@ type Configuration struct {
Devel bool `json:"devel"`
}
const version = "2.201"
const version = "2.217"
// baseURL givers the AUR default address.
const baseURL string = "https://aur.archlinux.org"
@ -106,6 +107,7 @@ func defaultSettings(config *Configuration) {
panic(err)
}
config.BuildDir = fmt.Sprintf("/tmp/yaytmp-%s/", u.Uid)
config.CleanAfter = false
config.Editor = ""
config.Devel = false
config.MakepkgBin = "/usr/bin/makepkg"

View file

@ -164,6 +164,10 @@ func PkgInstall(a *rpc.Pkg, flags []string) (finalmdeps []string, err error) {
err = makepkgcmd.Run()
if err == nil {
_ = saveVCSInfo()
if config.CleanAfter {
fmt.Println("\x1b[1;32m==> CleanAfter enabled. Deleting source folder.\x1b[0m")
os.RemoveAll(dir)
}
}
return
}

193
yay.8
View file

@ -66,6 +66,41 @@ Display repository packages first and then AUR packages\&.
Show AUR packages first and then repository packages\&.
.RE
.PP
\fB\-\-devel\fR
.RS 4
Check -git/-svn/-hg development version\&.
.RE
.PP
\fB\-\-nodevel\fR
.RS 4
Disable development version checking\&.
.RE
.PP
\fB\-\-afterclean\fR
.RS 4
Clean package sources after successful build\&.
.RE
.PP
\fB\-\-noafterclean\fR
.RS 4
Disable package sources cleaning after successful build\&.
.RE
.PP
\fB\-\-timeupdate\fR
.RS 4
Check package's modification date and version\&.
.RE
.PP
\fB\-\-notimeupdate\fR
.RS 4
Check only package version change\&.
.RE
.PP
\fB\-\-printconfig\fR
.RS 4
Prints current yay configuration\&.
.RE
.PP
\fB\-\-noconfirm\fR
.RS 4
No user intervention needed unless a package conflict happens. This option will be passed to pacman and makepkg\&.
@ -77,97 +112,97 @@ All other options will be passed to pacman\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Sync and update packages from repository and AUR:
yay \-Syu
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Check installed packages health:
yay \-Qstats
.RE
.PP
.sp
For a package called \fIname\fR:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Sync and update packages from repository and AUR:
yay \-Syu
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Check installed packages health:
yay \-Qstats
.RE
.PP
.sp
For a package called \fIname\fR:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Search:
yay \-Ss \fIname\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Install:
yay \-S \fIname\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Install without confirmations:
yay \-S \-\-noconfirm \fIname\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Get information about a package:
yay \-Si \fIname\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Search and install using yogurt mode:
yay \fIname\fR
.RE
.SH "SEE ALSO"
.sp
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Install without confirmations:
yay \-S \-\-noconfirm \fIname\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Get information about a package:
yay \-Si \fIname\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Search and install using yogurt mode:
yay \fIname\fR
.RE
.SH "SEE ALSO"
.sp
\fBmakepkg\fR(8)
.sp
.sp
\fBpacman\fR(8)
.sp
.sp
\fBpacman.conf\fR(5)
.SH "AUTHORS"
.sp
Jguer <joaogg3@gmail\&.com>
.SH "AUTHORS"
.sp
Jguer <joaogg3@gmail\&.com>