github.com/apptainer/singularity@v3.1.1+incompatible/cmd/internal/cli/capability_avail_linux.go (about)

     1  // Copyright (c) 2019, Sylabs Inc. All rights reserved.
     2  // This software is licensed under a 3-clause BSD license. Please consult the
     3  // LICENSE.md file distributed with the sources of this project regarding your
     4  // rights to use or distribute this software.
     5  
     6  package cli
     7  
     8  import (
     9  	"github.com/spf13/cobra"
    10  	"github.com/sylabs/singularity/docs"
    11  	"github.com/sylabs/singularity/internal/app/singularity"
    12  	"github.com/sylabs/singularity/internal/pkg/sylog"
    13  )
    14  
    15  func init() {
    16  	CapabilityAvailCmd.Flags().SetInterspersed(false)
    17  }
    18  
    19  // CapabilityAvailCmd singularity capability avail
    20  var CapabilityAvailCmd = &cobra.Command{
    21  	Args:                  cobra.RangeArgs(0, 1),
    22  	DisableFlagsInUseLine: true,
    23  	Run: func(cmd *cobra.Command, args []string) {
    24  		caps := ""
    25  		if len(args) > 0 {
    26  			caps = args[0]
    27  		}
    28  		c := singularity.CapAvailConfig{
    29  			Caps: caps,
    30  			Desc: len(args) == 0,
    31  		}
    32  		if err := singularity.CapabilityAvail(c); err != nil {
    33  			sylog.Fatalf("Unable to list available capabilities: %s", err)
    34  		}
    35  	},
    36  
    37  	Use:     docs.CapabilityAvailUse,
    38  	Short:   docs.CapabilityAvailShort,
    39  	Long:    docs.CapabilityAvailLong,
    40  	Example: docs.CapabilityAvailExample,
    41  }