Commit Graph

979 Commits

Author SHA1 Message Date
morganamilo
3084f91ba7
Reimplement getpkgbuild
Futre todos:
	Add option to fetch deps
	Add option to set download path
2018-01-04 08:32:50 +00:00
morganamilo
68a9771327
Move passToPackman from config.go to cmd.go 2018-01-04 08:32:50 +00:00
morganamilo
df27396fa0
Teach passToPacman how to use argParsers
passToPacman now takes and argParser as a paramater. And is implemented
for the simple cases in cmd.go. Although passToPacman is now left non
working in places which still try to usr the old call format and will
need to be reimplemented.
2018-01-04 08:32:50 +00:00
morganamilo
2b47a4d9f0
Refactor away os.Exit
Try to minimise the useage of os.Exit

Apart from init, os.Exit is only used once as the final function call.
Now we can ensure there are no random exits hidding in the code. We can
also allow part of the code to error and continue on while also
remembering that we did error and return non 0 when we finally do reach
the os.Exit. This comes in very handy for trying to save the vcs info
after an error and ensuring that alpmHandle.Release is always called.
2018-01-04 08:32:50 +00:00
morganamilo
765b767333
Rework some of the yay specific operations
Some of the yay specific operations such as:
	'-Qstats' '-Cd'
Break the standard pacamn has set.

Most yay specific specific options have been moved into their own
operator:
	'-Y' '--yay'
	'-Qstats' -> '-Y --stats'
	'--Cd' -> '-Y --cleandeps'
	'--gendb' -> '-Y --gendb'
Although:
	'-G'
has been kepts and and alias has been added for is:
	'--getpkgbuild'

This shouldnt feel too different for most people given that yay will
default to:
	'-Y'
when no operator has been specified. So calls like:
	'yay --gendb'
will still work as they did.

Internally handleConfig has been partially refactored. Now all that
remians in setters for config. All flags that did anything beond setting
config have been moved to handleYay(). This means less nasty
os.Exit()'s and nicer flow control.

The usage has also been updated. The options changes have been added but
the layout has also been tweaked a bit.

Lastly on the things not done:
	Man page has not been updated
	Shell completion has not been updated

This will be done in further commits as the usage is not guaranteed
to stay the same between now the completion of the argument system.
2018-01-04 08:32:44 +00:00
morganamilo
19efb1f121
Foundation for re writing the argument parsing system
Currently the foundation for a new fuller argument parsing has been implemented in
parser.go. Most of the parsing is now done through the argParser object
instead of seperate arrays for options and packages. The rest of the
code still expects the old system so I have left most of the operations
unimplemented for now until I redo it with the new system. Currently
only '-S' and number menu have any functionality for testing purposes.

This new system parses arguments fully instead of just looking for
predefined strings such as:
	'-Sqi' '-Siq'.
This allows:
	'-Syu', '-S -y -u', '--sync -y -u'
to all be parsed as the same.

This system tries to be as similar to pacman as possible, eventually
aming to fully wrap pacman, allowing yay to be used instead of pacman in
all instances.

The current implementation is not as strict as pacman when checking
arguments.  If you pass
--someinvalidflag to yay then yay will simply ignore it. The flag should
still be passed to pacman which should then cause an error.

Although operations '-S' '-R' '-U' ect. are checked to make sure you can not
try to use two operations at once.

conflicting flags such as:
	'--quiet' and '--info'
will not raise an error and which options gains precedence is depend on
the implementation.

Another minor issue which is worth noting is. Due to the way double
arguments are parsed:
	'-dd' '-cc' '--deps --deps'
if you pass the long version and the short version:
	'-d --deps'
yay will not realize its a double argument. Meanwhile pacman will
reconise it when yay calls pacman.

Currently there are a few things that need to be done before this new
system can be fuly released:
	Reimplement all operations to use to new parsing system so that
		the new system is at least as functional as the old one
	Strip yay specific flags before passing them to pacman
	Move parts of config into the argument system and only use
		config for options that are meant to be saved to disk
	Move yay specific operations into its own operator '-Y'
	Update documentation to show the altered syntax
2018-01-04 01:14:25 +00:00
morganamilo
952d95273a
Fix crash when package version is "invalid" 2017-12-30 22:52:33 +00:00
morganamilo
c0eac580a8
Count from 1 instead of 0 when searching packages
I feel like starting from 1 is much better ergonomically while not using
a numpad. This could be added as a config option instead if you would
prefer.
2017-12-30 06:18:09 +00:00
morganamilo
04bd59450c
Add missing --bottomup option
This option was mentioned in --help and the man page but not implemented
in the arg parsing
2017-12-30 05:54:43 +00:00
J Guerreiro
1fabad45e2
Updated Pictures and Changelog 2017-12-06 10:11:03 +09:00
Jguer
6305f86a3a
Minor polishing using gometalinter. 2017-12-04 15:24:20 +09:00
Jguer
2ca3f4d726
Fixed man page indenting. 2017-12-04 12:03:10 +09:00
Jguer
4c7f341dd2
References #64. Added optional afterclean. Updates man page. Adds entries to --help 2017-12-04 11:39:23 +09:00
J Guerreiro
22931a77a3
Merge pull request #68 from PietroCarrara/master
Using '-' doesn't raise an error
2017-11-28 11:51:53 +09:00
Pietro Carrara
e0050a63db Using '-' doesn't raise an error 2017-11-27 10:46:18 -02:00
J Guerreiro
3913673c8c
Merge pull request #67 from maximbaz/print_vcs_error_details
Print VCS error details
2017-11-21 13:41:04 +09:00
J Guerreiro
324ff366bc
Merge pull request #66 from maximbaz/truncate_config_files_before_writing
Prevent file corruption by truncating the files
2017-11-21 13:31:16 +09:00
Maxim Baz
fdf41a6418
Print VCS error details 2017-11-21 01:34:27 +01:00
Maxim Baz
34d0f372fd
Prevent file corruption by truncating the files 2017-11-21 00:41:55 +01:00
J Guerreiro
878c606556
Merge pull request #63 from AnthonyLam/issue-49
Add -V and -h for flag parsing
2017-11-12 10:48:27 +09:00
Anthony Lam
ba8e3c98e7 Add -V and -h for flag parsing 2017-11-08 22:00:29 -08:00
Jguer
97bb7d0a9c Merge branch 'updateIgnore' 2017-10-30 21:41:50 +09:00
Jguer
138b0f27dd Check if package is already in upgrade list and skip it. References #60 2017-10-30 21:36:50 +09:00
Jguer
1f29de4805 References #61 2017-10-30 21:19:05 +09:00
Jguer
83e8c54caa ./yay - no longer crashes yay 2017-10-25 17:16:35 +09:00
Jguer
7a8933b8fc Readded showing new update ignored version 2017-10-25 16:17:13 +09:00
Jguer
61a1d46ccd Should resolve #59 2017-10-25 14:42:03 +09:00
Jguer
58ab6fd06f File closure fixed on init 2017-10-19 14:59:26 +09:00
Jguer
a46e6bfa7b Rollback on aggressive permission changes 2017-10-19 11:56:19 +09:00
Jguer
a6a0b9b441 git devel package support restored, house keeping, fixes related to config files. 2017-10-19 11:30:37 +09:00
Jguer
bc7ff1799b Github package updates are back, missing generate Database on fresh installs 2017-10-18 14:46:21 +09:00
Jguer
8fa7c4069e Resolves #57. Added Package ignoring to AUR. Handles made private. 2017-10-18 11:38:19 +09:00
Jguer
b016bf6d53 Added support for XDG_CACHE_HOME, fixes relating to file location not covered in the commit relating to #50. 2017-10-18 11:12:16 +09:00
J Guerreiro
893196bd82 Merge pull request #55 from goggle/typo-readme
Fix two typos in README.md
2017-10-17 11:21:29 +09:00
Alex Seiler
44f4864034 Revert changes in README.md to 'apacman', add hyperlinks 2017-10-17 04:01:56 +02:00
Alex Seiler
f34c413670 Fix two typos in README.md 2017-10-16 20:33:10 +02:00
Jguer
93de8ba9b3 Use XDG_CONFIG_HOME as default config directory instead of hardcoded when available. Fixes #50 2017-10-16 23:38:51 +09:00
J Guerreiro
131e61af5d Merge pull request #53 from whereswaldon/nonexec-config
Make default config file non-executable
2017-10-16 16:46:09 +09:00
J Guerreiro
2e409ae5b6 Merge pull request #51 from whereswaldon/typos
Resolve a few typos in documentation
2017-10-16 16:45:48 +09:00
Chris Waldon
66371b4cfb Make default config file non-executable 2017-10-14 13:01:54 -04:00
Chris Waldon
14c1a17d77 Resolve a few typos in documentation 2017-10-14 12:11:47 -04:00
Jguer
4b78c23fb9 Merged flatten branch 2017-10-03 00:54:34 +09:00
J Guerreiro
771eca9cf7 Merge pull request #48 from afg984/aur-dep
use Command.Dir in aur.PkgInstall; attempt to fix #32 #47
2017-10-03 00:04:55 +09:00
afg
56be9fde2a use Command.Dir in aur.PkgInstall; attempt to fix #32 #47 2017-09-30 23:13:02 +08:00
Jguer
35b975a03c Fixes #45 2017-09-12 11:38:42 +09:00
J Guerreiro
d295a80203 Merge pull request #44 from afg984/uidsuffix
Suffix BuildDir with uid to avoid perm problems
2017-09-06 00:04:01 +09:00
afg
b3826dbb18 Suffix YayConf.BuildDir with uid to avoid permission issues between different users 2017-09-05 10:51:09 +08:00
jguer
9afd66109a FilterPackages replaces ForeignPackages 2017-08-07 14:43:25 +01:00
jguer
ef454680dc Fixed tests for unified structure 2017-08-07 10:53:20 +01:00
jguer
418c27f7e3 Removed empty package 2017-08-07 10:35:21 +01:00