Merge pull request #596 from Morganamilo/config

Always pass PacmanConf to pacman
This commit is contained in:
Anna authored and GitHub committed 2018-07-28 19:57:28 +01:00
commit bd3e1cd3a9
4 files changed
+22 -21

No files matched your search

+2 -12
View File
@@ -119,18 +119,6 @@ If no operation is provided -Y will be assumed`)
}
func handleCmd() (err error) {
for option, value := range cmdArgs.options {
if handleConfig(option, value) {
cmdArgs.delArg(option)
}
}
for option, value := range cmdArgs.globals {
if handleConfig(option, value) {
cmdArgs.delArg(option)
}
}
if shouldSaveConfig {
config.saveConfig()
}
@@ -232,6 +220,8 @@ func handleConfig(option, value string) bool {
config.SortBy = value
case "noconfirm":
config.NoConfirm = true
case "config":
config.PacmanConf = value
case "redownload":
config.ReDownload = "yes"
case "redownloadall":
+1 -1
View File
@@ -85,8 +85,8 @@ func passToPacman(args *arguments) *exec.Cmd {
argArr = append(argArr, "--noconfirm")
}
argArr = append(argArr, "--config", config.PacmanConf)
argArr = append(argArr, "--")
argArr = append(argArr, args.targets...)
if args.needRoot() {
+2 -5
View File
@@ -109,11 +109,6 @@ func initAlpm() (err error) {
var exists bool
//var double bool
value, _, exists = cmdArgs.getArg("config")
if exists {
config.PacmanConf = value
}
alpmConf, err = readAlpmConfig(config.PacmanConf)
if err != nil {
err = fmt.Errorf("Unable to read Pacman conf: %s", err)
@@ -223,6 +218,8 @@ func main() {
goto cleanup
}
cmdArgs.extractYayOptions()
err = initVCS()
if err != nil {
fmt.Println(err)
+17 -3
View File
@@ -593,10 +593,10 @@ func (parser *arguments) parseCommandLine() (err error) {
parser.op = "Y"
}
if cmdArgs.existsArg("-") {
if parser.existsArg("-") {
var file *os.File
err = cmdArgs.parseStdin()
cmdArgs.delArg("-")
err = parser.parseStdin()
parser.delArg("-")
if err != nil {
return
@@ -614,6 +614,20 @@ func (parser *arguments) parseCommandLine() (err error) {
return
}
func (parser *arguments) extractYayOptions() {
for option, value := range parser.options {
if handleConfig(option, value) {
parser.delArg(option)
}
}
for option, value := range parser.globals {
if handleConfig(option, value) {
parser.delArg(option)
}
}
}
//parses input for number menus splitted by spaces or commas
//supports individual selection: 1 2 3 4
//supports range selections: 1-4 10-20