github.com/kata-containers/tests@v0.0.0-20240307153542-772105b56064/cmd/github-labels/types.go (about)

     1  // Copyright (c) 2019 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package main
     7  
     8  type Category struct {
     9  	Name        string
    10  	Description string
    11  	URL         string `yaml:",omitempty"`
    12  }
    13  
    14  type Label struct {
    15  	Name         string
    16  	Description  string
    17  	CategoryName string `yaml:"category"`
    18  	Colour       string `yaml:"color"`
    19  	From         string `yaml:",omitempty"`
    20  }
    21  
    22  type Categories []Category
    23  
    24  func (c Categories) Len() int {
    25  	return len(c)
    26  }
    27  
    28  func (c Categories) Swap(i, j int) {
    29  	c[i], c[j] = c[j], c[i]
    30  }
    31  
    32  func (c Categories) Less(i, j int) bool {
    33  	return c[i].Name < c[j].Name
    34  }
    35  
    36  type Labels []Label
    37  
    38  func (l Labels) Len() int {
    39  	return len(l)
    40  }
    41  
    42  func (l Labels) Swap(i, j int) {
    43  	l[i], l[j] = l[j], l[i]
    44  }
    45  
    46  func (l Labels) Less(i, j int) bool {
    47  	return l[i].Name < l[j].Name
    48  }
    49  
    50  type LabelsFile struct {
    51  	Description string
    52  	Categories  Categories
    53  	Repo        string
    54  	Labels      Labels
    55  }