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

     1  // Copyright (c) 2018-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  )
    12  
    13  func init() {
    14  	options := []string{
    15  		"add-caps",
    16  		"allow-setuid",
    17  		"apply-cgroups",
    18  		"bind",
    19  		"boot",
    20  		"contain",
    21  		"containall",
    22  		"containlibs",
    23  		"cleanenv",
    24  		"docker-login",
    25  		"docker-username",
    26  		"docker-password",
    27  		"dns",
    28  		"drop-caps",
    29  		"fakeroot",
    30  		"home",
    31  		"hostname",
    32  		"keep-privs",
    33  		"net",
    34  		"network",
    35  		"network-args",
    36  		"no-home",
    37  		"no-nv",
    38  		"no-privs",
    39  		"nv",
    40  		"overlay",
    41  		"scratch",
    42  		"security",
    43  		"userns",
    44  		"uts",
    45  		"workdir",
    46  		"writable",
    47  		"writable-tmpfs",
    48  	}
    49  
    50  	for _, opt := range options {
    51  		InstanceStartCmd.Flags().AddFlag(actionFlags.Lookup(opt))
    52  	}
    53  
    54  	InstanceStartCmd.Flags().SetInterspersed(false)
    55  }
    56  
    57  // InstanceStartCmd singularity instance start
    58  var InstanceStartCmd = &cobra.Command{
    59  	Args:                  cobra.MinimumNArgs(2),
    60  	PreRun:                replaceURIWithImage,
    61  	DisableFlagsInUseLine: true,
    62  	Run: func(cmd *cobra.Command, args []string) {
    63  		a := append([]string{"/.singularity.d/actions/start"}, args[2:]...)
    64  		execStarter(cmd, args[0], a, args[1])
    65  	},
    66  
    67  	Use:     docs.InstanceStartUse,
    68  	Short:   docs.InstanceStartShort,
    69  	Long:    docs.InstanceStartLong,
    70  	Example: docs.InstanceStartExample,
    71  }