...

Text file src/cuelang.org/go/pkg/tool/os/os.cue

Documentation: cuelang.org/go/pkg/tool/os

     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
    15package os
    16
    17// A Value are all possible values allowed in flags.
    18// A null value unsets an environment variable.
    19Value: bool | number | *string | null
    20
    21// Name indicates a valid flag name.
    22Name: !="" & !~"^[$]"
    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.
    29Setenv: {
    30	$id: "tool/os.Setenv"
    31
    32	{[Name]: Value}
    33}
    34
    35// Getenv gets and parses the specific command line variables.
    36Getenv: {
    37	$id: "tool/os.Getenv"
    38
    39	{[Name]: Value}
    40}
    41
    42// Environ populates a struct with all environment variables.
    43Environ: {
    44	$id: "tool/os.Environ"
    45
    46	// A map of all populated values.
    47	// Individual entries may be specified ahead of time to enable
    48	// validation and parsing. Values that are marked as required
    49	// will fail the task if they are not found.
    50	{[Name]: Value}
    51}
    52
    53// Clearenv clears all environment variables.
    54Clearenv: {
    55	$id: "tool/os.Clearenv"
    56}

View as plain text