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 -G [package(s)] get pkgbuild from ABS or AUR
yay --gendb generates development package DB used for updating. yay --gendb generates development package DB used for updating.
New options: Permanent configuration options:
--topdown shows repository's packages first and then aur's --topdown shows repository's packages first and then aur's
--bottomup shows aur's packages first and then repository'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 --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() { func init() {
@ -155,8 +163,12 @@ func parser() (op string, options []string, packages []string, changedConfig boo
if strings.HasPrefix(arg, "--") { if strings.HasPrefix(arg, "--") {
changedConfig = true changedConfig = true
switch arg { switch arg {
case "--afterclean":
config.CleanAfter = true
case "--noafterclean":
config.CleanAfter = false
case "--printconfig": case "--printconfig":
fmt.Printf("%+v", config) fmt.Printf("%#v", config)
os.Exit(0) os.Exit(0)
case "--gendb": case "--gendb":
err = createDevelDB() err = createDevelDB()

View file

@ -27,6 +27,7 @@ const (
// Configuration stores yay's config. // Configuration stores yay's config.
type Configuration struct { type Configuration struct {
BuildDir string `json:"buildDir"` BuildDir string `json:"buildDir"`
CleanAfter bool `json:"cleanAfter"`
Editor string `json:"editor"` Editor string `json:"editor"`
MakepkgBin string `json:"makepkgbin"` MakepkgBin string `json:"makepkgbin"`
Shell string `json:"-"` Shell string `json:"-"`
@ -41,7 +42,7 @@ type Configuration struct {
Devel bool `json:"devel"` Devel bool `json:"devel"`
} }
const version = "2.201" const version = "2.217"
// baseURL givers the AUR default address. // baseURL givers the AUR default address.
const baseURL string = "https://aur.archlinux.org" const baseURL string = "https://aur.archlinux.org"
@ -106,6 +107,7 @@ func defaultSettings(config *Configuration) {
panic(err) panic(err)
} }
config.BuildDir = fmt.Sprintf("/tmp/yaytmp-%s/", u.Uid) config.BuildDir = fmt.Sprintf("/tmp/yaytmp-%s/", u.Uid)
config.CleanAfter = false
config.Editor = "" config.Editor = ""
config.Devel = false config.Devel = false
config.MakepkgBin = "/usr/bin/makepkg" 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() err = makepkgcmd.Run()
if err == nil { if err == nil {
_ = saveVCSInfo() _ = saveVCSInfo()
if config.CleanAfter {
fmt.Println("\x1b[1;32m==> CleanAfter enabled. Deleting source folder.\x1b[0m")
os.RemoveAll(dir)
}
} }
return 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\&. Show AUR packages first and then repository packages\&.
.RE .RE
.PP .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 \fB\-\-noconfirm\fR
.RS 4 .RS 4
No user intervention needed unless a package conflict happens. This option will be passed to pacman and makepkg\&. 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 .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Sync and update packages from repository and AUR: Sync and update packages from repository and AUR:
yay \-Syu yay \-Syu
.RE .RE
.sp .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Check installed packages health: Check installed packages health:
yay \-Qstats yay \-Qstats
.RE .RE
.PP .PP
.sp .sp
For a package called \fIname\fR: For a package called \fIname\fR:
.sp .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Search: Search:
yay \-Ss \fIname\fR yay \-Ss \fIname\fR
.RE .RE
.sp .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Install: Install:
yay \-S \fIname\fR yay \-S \fIname\fR
.RE .RE
.sp .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Install without confirmations: Install without confirmations:
yay \-S \-\-noconfirm \fIname\fR yay \-S \-\-noconfirm \fIname\fR
.RE .RE
.sp .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Get information about a package: Get information about a package:
yay \-Si \fIname\fR yay \-Si \fIname\fR
.RE .RE
.sp .sp
.RS 4 .RS 4
.ie n \{\ .ie n \{\
\h'-04'\(bu\h'+03'\c \h'-04'\(bu\h'+03'\c
.\} .\}
.el \{\ .el \{\
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
Search and install using yogurt mode: Search and install using yogurt mode:
yay \fIname\fR yay \fIname\fR
.RE .RE
.SH "SEE ALSO" .SH "SEE ALSO"
.sp .sp
\fBmakepkg\fR(8) \fBmakepkg\fR(8)
.sp .sp
\fBpacman\fR(8) \fBpacman\fR(8)
.sp .sp
\fBpacman.conf\fR(5) \fBpacman.conf\fR(5)
.SH "AUTHORS" .SH "AUTHORS"
.sp .sp
Jguer <joaogg3@gmail\&.com> Jguer <joaogg3@gmail\&.com>