feat: add filtering of targets by arch
							parent
							
								
									66d775d47b
								
							
						
					
					
						commit
						130daa0446
					
				| 
						 | 
					@ -46,6 +46,11 @@ pub fn cmd() cli.Command {
 | 
				
			||||||
						description: 'Search string to filter targets by.'
 | 
											description: 'Search string to filter targets by.'
 | 
				
			||||||
						flag: cli.FlagType.string
 | 
											flag: cli.FlagType.string
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
 | 
										cli.Flag{
 | 
				
			||||||
 | 
											name: 'arch'
 | 
				
			||||||
 | 
											description: 'Only list targets that build for this arch.'
 | 
				
			||||||
 | 
											flag: cli.FlagType.string
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
				]
 | 
									]
 | 
				
			||||||
				execute: fn (cmd cli.Command) ! {
 | 
									execute: fn (cmd cli.Command) ! {
 | 
				
			||||||
					config_file := cmd.flags.get_string('config-file')!
 | 
										config_file := cmd.flags.get_string('config-file')!
 | 
				
			||||||
| 
						 | 
					@ -73,6 +78,11 @@ pub fn cmd() cli.Command {
 | 
				
			||||||
						filter.query = query
 | 
											filter.query = query
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										arch := cmd.flags.get_string('arch')!
 | 
				
			||||||
 | 
										if arch != '' {
 | 
				
			||||||
 | 
											filter.arch = arch
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					raw := cmd.flags.get_bool('raw')!
 | 
										raw := cmd.flags.get_bool('raw')!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					list(conf, filter, raw)!
 | 
										list(conf, filter, raw)!
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +54,10 @@ fn (mut ti TargetsIterator) advance_window() {
 | 
				
			||||||
			ti.window = ti.window.filter(it.repo == ti.filter.repo)
 | 
								ti.window = ti.window.filter(it.repo == ti.filter.repo)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ti.filter.arch != '' {
 | 
				
			||||||
 | 
								ti.window = ti.window.filter(it.arch.any(it.value == ti.filter.arch))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ti.filter.query != '' {
 | 
							if ti.filter.query != '' {
 | 
				
			||||||
			ti.window = ti.window.filter(it.url.contains(ti.filter.query)
 | 
								ti.window = ti.window.filter(it.url.contains(ti.filter.query)
 | 
				
			||||||
				|| it.path.contains(ti.filter.query) || it.branch.contains(ti.filter.query))
 | 
									|| it.path.contains(ti.filter.query) || it.branch.contains(ti.filter.query))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,4 +74,5 @@ pub mut:
 | 
				
			||||||
	offset u64
 | 
						offset u64
 | 
				
			||||||
	repo   string
 | 
						repo   string
 | 
				
			||||||
	query  string
 | 
						query  string
 | 
				
			||||||
 | 
						arch   string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue