cuelang.org/go@v0.13.0/pkg/tool/os/os.cue (about)

     1  // Copyright 2019 The CUE Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package os
    16  
    17  // A Value are all possible values allowed in flags.
    18  // A null value unsets an environment variable.
    19  Value: bool | number | *string | null
    20  
    21  // Name indicates a valid flag name.
    22  Name: !="" & !~"^[$]"
    23  
    24  // Setenv defines a set of command line flags, the values of which will be set
    25  // at run time. The doc comment of the flag is presented to the user in help.
    26  //
    27  // To define a shorthand, define the shorthand as a new flag referring to
    28  // the flag of which it is a shorthand.
    29  Setenv: {
    30  	$id: _id
    31  	_id: "tool/os.Setenv"
    32  
    33  	{[Name]: Value}
    34  }
    35  
    36  // Getenv gets and parses the specific command line variables.
    37  Getenv: {
    38  	$id: _id
    39  	_id: "tool/os.Getenv"
    40  
    41  	{[Name]: Value}
    42  }
    43  
    44  // Environ populates a struct with all environment variables.
    45  Environ: {
    46  	$id: _id
    47  	_id: "tool/os.Environ"
    48  
    49  	// A map of all populated values.
    50  	// Individual entries may be specified ahead of time to enable
    51  	// validation and parsing. Values that are marked as required
    52  	// will fail the task if they are not found.
    53  	{[Name]: Value}
    54  }
    55  
    56  // Clearenv clears all environment variables.
    57  Clearenv: {
    58  	$id: _id
    59  	_id: "tool/os.Clearenv"
    60  }