xbps-alternatives(1): implemented -g <grp> -l.
This commit is contained in:
		
							
								
								
									
										3
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								NEWS
									
									
									
									
									
								
							| @@ -1,5 +1,8 @@ | ||||
| xbps-0.49 (???): | ||||
|  | ||||
|  * xbps-alternatives(1): -g <grp> -l now works. To only print all alternatives | ||||
|    associated with this group. | ||||
|  | ||||
|  * xbps-remove(1): this now will print the messages from alternatives. | ||||
|  | ||||
|  * alternatives: do not register duplicate alternative groups. Happened when | ||||
|   | ||||
| @@ -108,7 +108,7 @@ list_pkg_alternatives(xbps_dictionary_t pkgd, const char *group, bool print_key) | ||||
| } | ||||
|  | ||||
| static int | ||||
| list_alternatives(struct xbps_handle *xhp, const char *pkgname) | ||||
| list_alternatives(struct xbps_handle *xhp, const char *pkgname, const char *grp) | ||||
| { | ||||
| 	xbps_dictionary_t alternatives, pkgd; | ||||
| 	xbps_array_t allkeys; | ||||
| @@ -139,6 +139,9 @@ list_alternatives(struct xbps_handle *xhp, const char *pkgname) | ||||
| 		keyname = xbps_dictionary_keysym_cstring_nocopy(keysym); | ||||
| 		array = xbps_dictionary_get_keysym(alternatives, keysym); | ||||
|  | ||||
| 		if (grp && strcmp(grp, keyname)) | ||||
| 			continue; | ||||
|  | ||||
| 		printf("%s\n", keyname); | ||||
| 		for (unsigned int x = 0; x < xbps_array_count(array); x++) { | ||||
| 			const char *str; | ||||
| @@ -247,7 +250,7 @@ main(int argc, char **argv) | ||||
| 			rv = xbps_pkgdb_update(&xh, true, true); | ||||
| 	} else if (list_mode) { | ||||
| 		/* list alternative groups */ | ||||
| 		rv = list_alternatives(&xh, pkg); | ||||
| 		rv = list_alternatives(&xh, pkg, group); | ||||
| 	} | ||||
|  | ||||
| 	xbps_end(&xh); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| .Dd October 30, 2015 | ||||
| .Dd October 31, 2015 | ||||
| .Dt XBPS-ALTERNATIVES 1 | ||||
| .Sh NAME | ||||
| .Nm xbps-alternatives | ||||
| @@ -43,9 +43,12 @@ Show the version information. | ||||
| .Sh MODE | ||||
| Only one of the following modes can be used at a time. | ||||
| .Bl -tag -width -x | ||||
| .It Fl l, Fl -list Op PKG | ||||
| Lists all current alternatives or only from | ||||
| .Ar PKG . | ||||
| .It Fl l, Fl -list Op PKG Op -g Ar group | ||||
| Lists all current alternative groups or only from | ||||
| .Ar PKG , | ||||
| or just a specific group, if the | ||||
| .Fl g Fl -group | ||||
| option is set. | ||||
| .It Fl s, Fl -set Ar PKG Op -g Ar group | ||||
| Set alternative groups specified by | ||||
| .Ar PKG | ||||
|   | ||||
		Reference in New Issue
	
	Block a user