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