blob: 56e172430939322158ca66616eed5961c631bda2 [file] [log] [blame]
Marcel van Lohuizen42346df2019-12-19 14:09:54 +01001// Copyright 2019 The CUE Authors
Marcel van Lohuizen0240d4e2020-05-12 15:30:55 +02002//
Marcel van Lohuizen42346df2019-12-19 14:09:54 +01003// 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
Marcel van Lohuizen0240d4e2020-05-12 15:30:55 +02006//
Marcel van Lohuizen42346df2019-12-19 14:09:54 +01007// http://www.apache.org/licenses/LICENSE-2.0
Marcel van Lohuizen0240d4e2020-05-12 15:30:55 +02008//
Marcel van Lohuizen42346df2019-12-19 14:09:54 +01009// 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.
Marcel van Lohuizen0240d4e2020-05-12 15:30:55 +020019Value: bool | number | *string | null
Marcel van Lohuizen42346df2019-12-19 14:09:54 +010020
21// Name indicates a valid flag name.
Marcel van Lohuizen0240d4e2020-05-12 15:30:55 +020022Name: !="" & !~"^[$]"
Marcel van Lohuizen42346df2019-12-19 14:09:54 +010023
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
Marcel van Lohuizen56c994d2020-04-21 16:20:36 +020032 {[Name]: Value}
Marcel van Lohuizen42346df2019-12-19 14:09:54 +010033}
34
35// Getenv gets and parses the specific command line variables.
36Getenv: {
37 $id: "tool/os.Getenv"
38
Marcel van Lohuizen56c994d2020-04-21 16:20:36 +020039 {[Name]: Value}
Marcel van Lohuizen42346df2019-12-19 14:09:54 +010040}
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.
Marcel van Lohuizen56c994d2020-04-21 16:20:36 +020050 {[Name]: Value}
Marcel van Lohuizen42346df2019-12-19 14:09:54 +010051}
52
53// Clearenv clears all environment variables.
54Clearenv: {
55 $id: "tool/os.Clearenv"
56}