this repo has no description
at master 200 lines 5.3 kB view raw
1// Code generated by cuelang.org/go/pkg/gen. DO NOT EDIT. 2 3// Package file provides file operations for cue tasks. 4// 5// These are the supported tasks: 6// 7// // Read reads the contents of a file. 8// Read: { 9// $id: _id 10// _id: "tool/file.Read" 11// 12// // filename names the file to read. 13// // 14// // Relative names are taken relative to the current working directory. 15// // Slashes are converted to the native OS path separator. 16// filename: !="" 17// 18// // contents is the read contents. If the contents are constraint to bytes 19// // (the default), the file is read as is. If it is constraint to a string, 20// // the contents are checked to be valid UTF-8. 21// contents: *bytes | string 22// } 23// 24// // Append writes contents to the given file. 25// Append: { 26// $id: _id 27// _id: "tool/file.Append" 28// 29// // filename names the file to append. 30// // 31// // Relative names are taken relative to the current working directory. 32// // Slashes are converted to the native OS path separator. 33// filename: !="" 34// 35// // permissions defines the permissions to use if the file does not yet exist. 36// permissions: int | *0o666 37// 38// // contents specifies the bytes to be written. 39// contents: bytes | string 40// } 41// 42// // Create writes contents to the given file. 43// Create: { 44// $id: _id 45// _id: "tool/file.Create" 46// 47// // filename names the file to write. 48// // 49// // Relative names are taken relative to the current working directory. 50// // Slashes are converted to the native OS path separator. 51// filename: !="" 52// 53// // permissions defines the permissions to use if the file does not yet exist. 54// permissions: int | *0o666 55// 56// // contents specifies the bytes to be written. 57// contents: bytes | string 58// } 59// 60// // Glob returns a list of files. 61// Glob: { 62// $id: _id 63// _id: "tool/file.Glob" 64// 65// // glob specifies the pattern to match files with. 66// // 67// // A relative pattern is taken relative to the current working directory. 68// // Slashes are converted to the native OS path separator. 69// glob: !="" 70// files: [...string] 71// } 72// 73// // Mkdir creates a directory at the specified path. 74// Mkdir: { 75// $id: _id 76// _id: "tool/file.Mkdir" 77// 78// // The directory path to create. 79// // If path is already a directory, Mkdir does nothing. 80// // If path already exists and is not a directory, Mkdir will return an error. 81// path: string 82// 83// // When true any necessary parents are created as well. 84// createParents: bool | *false 85// 86// // Directory mode and permission bits (before umask). 87// permissions: int | *0o777 88// } 89// 90// // MkdirAll creates a directory at the specified path along with any necessary 91// // parents. 92// // If path is already a directory, MkdirAll does nothing. 93// // If path already exists and is not a directory, MkdirAll will return an error. 94// MkdirAll: Mkdir & { 95// createParents: true 96// } 97// 98// // MkdirTemp creates a new temporary directory in the directory dir and sets 99// // the pathname of the new directory in path. 100// // It is the caller's responsibility to remove the directory when it is no 101// // longer needed. 102// MkdirTemp: { 103// $id: _id 104// _id: "tool/file.MkdirTemp" 105// 106// // The temporary directory is created in the directory specified by dir. 107// // If dir is the empty string, MkdirTemp uses the default directory for 108// // temporary files. 109// dir: string | *"" 110// 111// // The directory name is generated by adding a random string to the end of pattern. 112// // If pattern includes a "*", the random string replaces the last "*" instead. 113// pattern: string | *"" 114// 115// // The absolute path of the created directory. 116// path: string 117// } 118// 119// // RemoveAll removes path and any children it contains. 120// // It removes everything it can but returns the first error it encounters. 121// RemoveAll: { 122// $id: _id 123// _id: "tool/file.RemoveAll" 124// 125// // The path to remove. 126// // If the path does not exist, RemoveAll does nothing. 127// path: string 128// 129// // success contains the status of the removal. 130// // If path was removed success is set to true. 131// // If path didn't exists success is set to false. 132// success: bool 133// } 134package file 135 136import ( 137 "cuelang.org/go/internal/core/adt" 138 "cuelang.org/go/internal/pkg" 139) 140 141func init() { 142 pkg.Register("tool/file", p) 143} 144 145var _ = adt.TopKind // in case the adt package isn't used 146 147var p = &pkg.Package{ 148 Native: []*pkg.Builtin{}, 149 CUE: `{ 150 Read: { 151 $id: _id 152 _id: "tool/file.Read" 153 filename: !="" 154 contents: *bytes | string 155 } 156 Append: { 157 $id: _id 158 _id: "tool/file.Append" 159 filename: !="" 160 permissions: int | *0o666 161 contents: bytes | string 162 } 163 Create: { 164 $id: _id 165 _id: "tool/file.Create" 166 filename: !="" 167 permissions: int | *0o666 168 contents: bytes | string 169 } 170 Glob: { 171 $id: _id 172 _id: "tool/file.Glob" 173 glob: !="" 174 files: [...string] 175 } 176 Mkdir: { 177 $id: _id 178 _id: "tool/file.Mkdir" 179 path: string 180 createParents: bool | *false 181 permissions: int | *0o777 182 } 183 MkdirAll: Mkdir & { 184 createParents: true 185 } 186 MkdirTemp: { 187 $id: _id 188 _id: "tool/file.MkdirTemp" 189 dir: string | *"" 190 pattern: string | *"" 191 path: string 192 } 193 RemoveAll: { 194 $id: _id 195 _id: "tool/file.RemoveAll" 196 path: string 197 success: bool 198 } 199}`, 200}