├── cue ├── load │ ├── testdata │ │ ├── anon │ │ │ ├── dummy │ │ │ └── anon.cue │ │ ├── empty │ │ │ └── dummy │ │ ├── anon.cue │ │ ├── hello │ │ │ └── test.cue │ │ ├── other │ │ │ ├── file │ │ │ │ └── file.cue │ │ │ ├── anon.cue │ │ │ └── main.cue │ │ ├── tags │ │ │ ├── stage.cue │ │ │ └── prod.cue │ │ ├── tagsbad │ │ │ ├── stage.cue │ │ │ └── prod.cue │ │ ├── cue.mod │ │ │ ├── pkg │ │ │ │ └── acme.com │ │ │ │ │ ├── helper │ │ │ │ │ ├── helper.cue │ │ │ │ │ ├── helper1.cue │ │ │ │ │ └── helper2.cue │ │ │ │ │ └── catch │ │ │ │ │ └── catch.cue │ │ │ └── module.cue │ │ ├── multi │ │ │ ├── file.cue │ │ │ └── file_appengine.cue │ │ ├── test.cue │ │ ├── imports │ │ │ └── imports.cue │ │ ├── toolonly │ │ │ └── foo_tool.cue │ │ └── sub │ │ │ └── sub.cue │ ├── test.cue │ └── doc.go ├── scanner │ └── corpus │ │ ├── +package.cue │ │ ├── +tokens.cue │ │ ├── +comments.cue │ │ └── +basic.cue ├── parser │ ├── corpus │ │ ├── +data.cue │ │ ├── +test.cue │ │ ├── +comp.cue │ │ ├── +import.cue │ │ ├── +hello.cue │ │ └── +commas.cue │ └── testdata │ │ └── test.cue ├── testdata │ ├── resolve │ │ ├── 002.txtar │ │ ├── 003_resolution_of_quoted_identifiers.txtar │ │ ├── 000_convert___to_top.txtar │ │ ├── 014_null_coalescing.txtar │ │ └── 004.txtar │ ├── references │ │ ├── embed_self.txtar │ │ ├── labelstop.txtar │ │ ├── optional.txtar │ │ └── package.txtar │ ├── eval │ │ ├── structs.txtar │ │ ├── issue295.txtar │ │ ├── expressions.txtar │ │ ├── errunifiy.txtar │ │ ├── cycles_ref.txtar │ │ ├── resolve_basic.txtar │ │ ├── let.txtar │ │ ├── issue353.txtar │ │ └── basictypes.txtar │ ├── builtins │ │ ├── or.txtar │ │ ├── list │ │ │ └── sort.txtar │ │ └── issue299.txtar │ ├── definitions │ │ ├── dynamic.txtar │ │ ├── issue496.txtar │ │ ├── issue497.txtar │ │ ├── list.txtar │ │ ├── visibility.txtar │ │ └── defembed.txtar │ ├── export │ │ ├── 013.txtar │ │ ├── 014.txtar │ │ ├── 000.txtar │ │ ├── 001.txtar │ │ ├── 032.txtar │ │ ├── 020.txtar │ │ ├── 026.txtar │ │ ├── 004.txtar │ │ ├── issue854.txtar │ │ ├── 015.txtar │ │ ├── 019.txtar │ │ ├── 003.txtar │ │ ├── 002.txtar │ │ ├── 005.txtar │ │ ├── 012.txtar │ │ ├── 027.txtar │ │ ├── 031.txtar │ │ ├── 008.txtar │ │ ├── 011.txtar │ │ └── 018.txtar │ ├── compile │ │ ├── fields.txtar │ │ ├── files.txtar │ │ ├── erralias.txtar │ │ └── json.txtar │ ├── cycle │ │ ├── cycle_with_bounds.txtar │ │ ├── patterns.txtar │ │ └── issue306.txtar │ ├── packages │ │ ├── issue398.txtar │ │ ├── sub.txtar │ │ └── embed.txtar │ ├── basicrewrite │ │ └── aliases │ │ │ └── aliases.txtar │ ├── fulleval │ │ ├── 054_issue312.txtar │ │ ├── 053_issue312.txtar │ │ ├── 017_resolutions_in_struct_comprehension_keys.txtar │ │ ├── 048_dont_pass_incomplete_values_to_builtins.txtar │ │ ├── 013_normalization.txtar │ │ └── 047_dont_bind_to_string_labels.txtar │ ├── comprehensions │ │ └── issue287.txtar │ └── choosedefault │ │ └── 001_simple_disambiguation_conflict.txtar ├── format │ └── testdata │ │ ├── values.input │ │ ├── values.golden │ │ ├── imports.golden │ │ └── imports.input ├── ast │ └── astutil │ │ └── testdata │ │ └── resolve │ │ ├── value.txtar │ │ └── let.txtar ├── build │ └── doc.go └── literal │ └── doc.go ├── encoding ├── openapi │ └── testdata │ │ ├── cue.mod │ │ ├── cycle.cue │ │ ├── pkg │ │ └── example.com │ │ │ └── blocks │ │ │ └── blocks.cue │ │ ├── issue131.cue │ │ ├── nested.cue │ │ ├── struct.cue │ │ ├── enum.cue │ │ ├── nums.cue │ │ ├── simple.cue │ │ ├── strings.cue │ │ ├── embed.cue │ │ ├── refs.cue │ │ ├── array.cue │ │ ├── cycle.json │ │ ├── enum.json │ │ ├── builtins.cue │ │ └── struct.json ├── gocode │ ├── testdata │ │ ├── cue.mod │ │ └── pkg2 │ │ │ └── instance.cue │ └── test.cue ├── protobuf │ ├── testdata │ │ ├── istio.io │ │ │ └── api │ │ │ │ ├── cue.mod │ │ │ │ └── gen │ │ │ │ │ └── googleapis.com │ │ │ │ │ └── acme │ │ │ │ │ └── test │ │ │ │ │ ├── test │ │ │ │ │ └── test_proto_gen.cue │ │ │ │ │ └── test_proto_gen.cue │ │ │ │ └── other │ │ │ │ └── trailcomment.proto │ │ ├── cue.proto.out.cue │ │ ├── acme │ │ │ ├── test.proto │ │ │ └── test │ │ │ │ └── test.proto │ │ └── trailcomment.proto.out.cue │ ├── textproto │ │ └── testdata │ │ │ ├── decoder │ │ │ ├── scalar.txtar │ │ │ ├── errors.txtar │ │ │ └── enums.txtar │ │ │ └── encoder │ │ │ ├── simple.txtar │ │ │ └── list.txtar │ ├── cue │ │ └── cue.proto │ ├── jsonpb │ │ └── testdata │ │ │ └── encoder │ │ │ ├── struct.txtar │ │ │ ├── list.txtar │ │ │ └── simple.txtar │ └── examples │ │ └── basic │ │ └── basic.proto └── jsonschema │ └── testdata │ ├── err.txtar │ ├── emptyanyof.txtar │ ├── refroot2.txtar │ ├── openapi.txtar │ ├── refroot.txtar │ └── emptyobj.txtar ├── cue.mod └── module.cue ├── pkg ├── tool │ ├── file │ │ └── testdata │ │ │ └── input.foo │ ├── cli │ │ └── pkg.go │ └── generate.go ├── crypto │ ├── md5 │ │ └── testdata │ │ │ └── gen.txtar │ ├── sha1 │ │ └── testdata │ │ │ └── gen.txtar │ ├── sha512 │ │ └── testdata │ │ │ └── gen.txtar │ └── sha256 │ │ └── testdata │ │ └── gen.txtar ├── text │ ├── template │ │ └── testdata │ │ │ └── gen.txtar │ └── tabwriter │ │ ├── testdata │ │ └── gen.txtar │ │ └── pkg.go ├── encoding │ ├── csv │ │ └── testdata │ │ │ └── gen.txtar │ └── hex │ │ └── testdata │ │ └── gen.txtar ├── math │ └── testdata │ │ └── issue418.txtar └── time │ └── testdata │ └── gen.txtar ├── doc ├── tutorial │ ├── kubernetes │ │ ├── quick │ │ │ ├── cue.mod │ │ │ │ ├── module.cue │ │ │ │ └── gen │ │ │ │ │ └── k8s.io │ │ │ │ │ ├── api │ │ │ │ │ ├── core │ │ │ │ │ │ └── v1 │ │ │ │ │ │ │ ├── register_go_gen.cue │ │ │ │ │ │ │ └── doc_go_gen.cue │ │ │ │ │ └── apps │ │ │ │ │ │ └── v1 │ │ │ │ │ │ └── register_go_gen.cue │ │ │ │ │ └── apimachinery │ │ │ │ │ └── pkg │ │ │ │ │ ├── runtime │ │ │ │ │ ├── embedded_go_gen.cue │ │ │ │ │ ├── types_proto_go_gen.cue │ │ │ │ │ ├── conversion_go_gen.cue │ │ │ │ │ ├── converter_go_gen.cue │ │ │ │ │ ├── negotiate_go_gen.cue │ │ │ │ │ ├── swagger_doc_generator_go_gen.cue │ │ │ │ │ └── helper_go_gen.cue │ │ │ │ │ ├── types │ │ │ │ │ ├── doc_go_gen.cue │ │ │ │ │ ├── namespacedname_go_gen.cue │ │ │ │ │ └── uid_go_gen.cue │ │ │ │ │ ├── apis │ │ │ │ │ └── meta │ │ │ │ │ │ └── v1 │ │ │ │ │ │ ├── register_go_gen.cue │ │ │ │ │ │ ├── duration_go_gen.cue │ │ │ │ │ │ ├── micro_time_go_gen.cue │ │ │ │ │ │ └── time_go_gen.cue │ │ │ │ │ ├── watch │ │ │ │ │ ├── doc_go_gen.cue │ │ │ │ │ ├── filter_go_gen.cue │ │ │ │ │ └── streamwatcher_go_gen.cue │ │ │ │ │ └── api │ │ │ │ │ └── resource │ │ │ │ │ ├── suffix_go_gen.cue │ │ │ │ │ └── math_go_gen.cue │ │ │ └── services │ │ │ │ ├── proxy │ │ │ │ ├── authproxy │ │ │ │ │ ├── service.cue │ │ │ │ │ └── kube.cue │ │ │ │ ├── kube.cue │ │ │ │ ├── goget │ │ │ │ │ ├── service.cue │ │ │ │ │ └── kube.cue │ │ │ │ └── nginx │ │ │ │ │ └── service.cue │ │ │ │ ├── mon │ │ │ │ └── kube.cue │ │ │ │ ├── infra │ │ │ │ ├── kube.cue │ │ │ │ ├── download │ │ │ │ │ └── kube.cue │ │ │ │ ├── watcher │ │ │ │ │ ├── service.cue │ │ │ │ │ └── kube.cue │ │ │ │ ├── tasks │ │ │ │ │ └── service.cue │ │ │ │ └── updater │ │ │ │ │ └── kube.cue │ │ │ │ ├── frontend │ │ │ │ ├── maitred │ │ │ │ │ └── kube.cue │ │ │ │ ├── bartender │ │ │ │ │ └── kube.cue │ │ │ │ ├── waiter │ │ │ │ │ └── kube.cue │ │ │ │ ├── host │ │ │ │ │ └── kube.cue │ │ │ │ ├── breaddispatcher │ │ │ │ │ └── kube.cue │ │ │ │ ├── waterdispatcher │ │ │ │ │ └── kube.cue │ │ │ │ ├── valeter │ │ │ │ │ └── kube.cue │ │ │ │ └── kube.cue │ │ │ │ ├── kube_tool.cue │ │ │ │ ├── dump_tool.cue │ │ │ │ ├── kitchen │ │ │ │ ├── souschef │ │ │ │ │ └── kube.cue │ │ │ │ ├── expiditer │ │ │ │ │ └── kube.cue │ │ │ │ ├── headchef │ │ │ │ │ └── kube.cue │ │ │ │ ├── linecook │ │ │ │ │ └── kube.cue │ │ │ │ ├── pastrychef │ │ │ │ │ └── kube.cue │ │ │ │ └── dishwasher │ │ │ │ │ └── kube.cue │ │ │ │ ├── k8s_defs.cue │ │ │ │ ├── create_tool.cue │ │ │ │ └── ls_tool.cue │ │ ├── manual │ │ │ ├── services │ │ │ │ ├── proxy │ │ │ │ │ ├── authproxy │ │ │ │ │ │ ├── service.cue │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── kube.cue │ │ │ │ │ ├── nginx │ │ │ │ │ │ ├── service.cue │ │ │ │ │ │ └── kube.cue │ │ │ │ │ └── goget │ │ │ │ │ │ ├── service.cue │ │ │ │ │ │ └── kube.cue │ │ │ │ ├── infra │ │ │ │ │ ├── kube.cue │ │ │ │ │ ├── download │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── watcher │ │ │ │ │ │ ├── service.cue │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── tasks │ │ │ │ │ │ ├── service.cue │ │ │ │ │ │ └── kube.cue │ │ │ │ │ └── updater │ │ │ │ │ │ └── kube.cue │ │ │ │ ├── mon │ │ │ │ │ └── kube.cue │ │ │ │ ├── frontend │ │ │ │ │ ├── maitred │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── bartender │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── host │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── waiter │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── waterdispatcher │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── valeter │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── breaddispatcher │ │ │ │ │ │ └── kube.cue │ │ │ │ │ └── kube.cue │ │ │ │ ├── kitchen │ │ │ │ │ ├── souschef │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── headchef │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── expiditer │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── dishwasher │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── linecook │ │ │ │ │ │ └── kube.cue │ │ │ │ │ ├── pastrychef │ │ │ │ │ │ └── kube.cue │ │ │ │ │ └── caller │ │ │ │ │ │ └── kube.cue │ │ │ │ ├── kube.cue │ │ │ │ ├── dump_tool.cue │ │ │ │ ├── kube_tool.cue │ │ │ │ ├── ls_tool.cue │ │ │ │ └── create_tool.cue │ │ │ └── cue.mod │ │ └── original │ │ │ └── services │ │ │ ├── proxy │ │ │ ├── authproxy │ │ │ │ └── service.yaml │ │ │ ├── goget │ │ │ │ └── service.yaml │ │ │ └── nginx │ │ │ │ └── service.yaml │ │ │ └── infra │ │ │ ├── tasks │ │ │ └── service.yaml │ │ │ └── watcher │ │ │ └── service.yaml │ └── basics │ │ ├── 6_expressions │ │ ├── 40_listcomp.txt │ │ ├── 20_interpolation.txt │ │ ├── 25_interpolfield.txt │ │ └── 55_conditional.txt │ │ ├── Readme.md │ │ ├── 4_references │ │ ├── 20_selectors.txt │ │ ├── 50_emit.txt │ │ ├── 99_hidden.txt │ │ └── 85_cycleref.txt │ │ ├── 0_intro │ │ ├── 80_boilerplate.txt │ │ ├── 50_order.txt │ │ └── 30_duplicates.txt │ │ └── 2_types │ │ ├── 65_sumstruct.txt │ │ └── 48_bytes.txt └── cmd │ └── cue.md ├── .gitattributes ├── cmd └── cue │ └── cmd │ └── testdata │ ├── script │ ├── cmd_filetypes.txt │ ├── eval_hidden.txt │ ├── go_cmd.txt │ ├── eval_loaderr.txt │ ├── import_dir.txt │ ├── issue236.txt │ ├── vet_opt.txt │ ├── issue425.txt │ ├── export_expr.txt │ ├── issue526.txt │ ├── eval_stdin.txt │ ├── fmt_stdin.txt │ ├── issue302.txt │ ├── eval_newline.txt │ ├── fmt.txt │ ├── eval_hiddenfail.txt │ ├── issue174.txt │ ├── toolonly.txt │ ├── issue303.txt │ ├── no_read_stdin.txt │ ├── eval_import.txt │ ├── issue322.txt │ ├── import_match.txt │ ├── issue312.txt │ ├── eval_e_hidden.txt │ ├── issue749.txt │ ├── eval_tool.txt │ ├── issue324.txt │ ├── issue304.txt │ ├── vet_altdata.txt │ ├── issue477.txt │ ├── cmd_import.txt │ ├── issue512.txt │ ├── export.txt │ ├── export_select.txt │ ├── issue398.txt │ ├── cmd_closed.txt │ ├── fmt_err.txt │ ├── issue315.txt │ ├── cmd_notool2.txt │ ├── issue217.txt │ ├── vet.txt │ ├── eval_tags.txt │ ├── issue289.txt │ ├── cmd_env.txt │ ├── cmd_errcode.txt │ ├── cmd_tags.txt │ ├── eval_concrete.txt │ ├── cmd_dir.txt │ ├── cmd_notool.txt │ ├── cmd_deppkg.txt │ ├── cmd_func.txt │ ├── cmd_ref.txt │ ├── vet_concrete.txt │ ├── def_basic.txt │ ├── issue525.txt │ ├── cmd_baddisplay.txt │ ├── cmd_stdin.txt │ ├── issue461.txt │ ├── export_yaml.txt │ ├── merge_interaction.txt │ ├── cmd_issue650.txt │ ├── issue116.txt │ ├── eval_expr.txt │ ├── def_force.txt │ ├── trim_force.txt │ ├── goproxytest.txt │ ├── eval_rec.txt │ ├── issue520.txt │ ├── get_go_unresolvable_package.txt │ ├── import_binary.txt │ ├── export_force.txt │ ├── cmd_run_list.txt │ ├── eval_force.txt │ ├── hidden.txt │ ├── import_files.txt │ ├── cmd_dep.txt │ ├── cmd_err.txt │ ├── cmd_run.txt │ ├── file_forms.txt │ ├── install.txt │ ├── install_go1.16.txt │ ├── issue986.txt │ ├── issue269.txt │ ├── cmd_http.txt │ ├── eval_context.txt │ ├── export_err.txt │ ├── cmd_print.txt │ ├── install_contributing.txt │ ├── issue476.txt │ ├── cmd_inferred.txt │ ├── install_contributing_go1.16.txt │ ├── vet_expr.txt │ ├── get_go_type_errors.txt │ └── vet_data.txt │ └── mod │ └── example.com_blah_v1.0.0.txt ├── .gitignore ├── codereview.cfg ├── .dockerignore ├── .github ├── workflows │ └── test.yml └── ISSUE_TEMPLATE │ └── feature_request.md ├── internal ├── core │ ├── dep │ │ └── testdata │ │ │ ├── alias.txtar │ │ │ ├── listcomprehension.txtar │ │ │ ├── list.txtar │ │ │ ├── composed.txtar │ │ │ ├── incomplete.txtar │ │ │ ├── self.txtar │ │ │ ├── structcomprehension.txtar │ │ │ ├── call.txtar │ │ │ ├── expr.txtar │ │ │ ├── field.txtar │ │ │ └── dynamic.txtar │ └── export │ │ └── testdata │ │ ├── scalardef.txtar │ │ └── def.txtar ├── third_party │ └── yaml │ │ ├── README.md │ │ ├── METADATA │ │ └── NOTICE └── filetypes │ └── test.cue ├── tools ├── trim │ └── testdata │ │ ├── definitions.txtar │ │ ├── listaccept.txtar │ │ ├── empty.txtar │ │ ├── rmimport.txtar │ │ └── optional.txtar └── flow │ └── testdata │ ├── failure.txtar │ └── cycle.txtar ├── AUTHORS └── README.md /cue/load/testdata/anon/dummy: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cue/load/testdata/empty/dummy: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/cue.mod: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cue/load/testdata/anon.cue: -------------------------------------------------------------------------------- 1 | world: "World" -------------------------------------------------------------------------------- /cue.mod/module.cue: -------------------------------------------------------------------------------- 1 | module: "cuelang.org/go" 2 | -------------------------------------------------------------------------------- /cue/load/testdata/anon/anon.cue: -------------------------------------------------------------------------------- 1 | world: "World" -------------------------------------------------------------------------------- /cue/scanner/corpus/+package.cue: -------------------------------------------------------------------------------- 1 | package main 2 | -------------------------------------------------------------------------------- /pkg/tool/file/testdata/input.foo: -------------------------------------------------------------------------------- 1 | This is a test. -------------------------------------------------------------------------------- /cue/load/test.cue: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | "Hello world!" -------------------------------------------------------------------------------- /cue/parser/corpus/+data.cue: -------------------------------------------------------------------------------- 1 | package hello 2 | 3 | who: "World" -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/module.cue: -------------------------------------------------------------------------------- 1 | module: "" 2 | -------------------------------------------------------------------------------- /cue/load/testdata/hello/test.cue: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | "Hello world!" -------------------------------------------------------------------------------- /cue/load/testdata/other/file/file.cue: -------------------------------------------------------------------------------- 1 | package file 2 | 3 | {} 4 | -------------------------------------------------------------------------------- /cue/load/testdata/tags/stage.cue: -------------------------------------------------------------------------------- 1 | @if(stage) 2 | 3 | package tags 4 | -------------------------------------------------------------------------------- /cue/load/testdata/other/anon.cue: -------------------------------------------------------------------------------- 1 | hello: "Hello \(world)" 2 | 3 | world: string -------------------------------------------------------------------------------- /cue/load/testdata/tagsbad/stage.cue: -------------------------------------------------------------------------------- 1 | package tagsbad 2 | 3 | @if(prod) 4 | -------------------------------------------------------------------------------- /cue/parser/corpus/+test.cue: -------------------------------------------------------------------------------- 1 | import "math" 2 | 3 | foo: 1 4 | bar: "baz" 5 | -------------------------------------------------------------------------------- /cue/parser/testdata/test.cue: -------------------------------------------------------------------------------- 1 | import "math" 2 | 3 | foo: 1 4 | bar: "baz" 5 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/proxy/authproxy/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/cycle.cue: -------------------------------------------------------------------------------- 1 | // Issue #915 2 | #Foo: [string]: #Foo 3 | -------------------------------------------------------------------------------- /cue/load/testdata/tagsbad/prod.cue: -------------------------------------------------------------------------------- 1 | @if(foo) 2 | @if(bar) 3 | 4 | package tagsbad 5 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/proxy/authproxy/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | -------------------------------------------------------------------------------- /encoding/gocode/testdata/cue.mod: -------------------------------------------------------------------------------- 1 | module: "cuelang.org/go/encoding/gocode/testdata" 2 | -------------------------------------------------------------------------------- /encoding/gocode/test.cue: -------------------------------------------------------------------------------- 1 | import "strings" 2 | 3 | a: strings.ContainsAny("X") & "car" 4 | -------------------------------------------------------------------------------- /cue/load/testdata/tags/prod.cue: -------------------------------------------------------------------------------- 1 | @if(prod) 2 | 3 | package tags 4 | 5 | foo: string @tag(foo) 6 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/mon/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | #Component: "mon" 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # To prevent CRLF breakages on Windows for fragile files, like testdata. 2 | * -text 3 | -------------------------------------------------------------------------------- /cue/load/testdata/cue.mod/pkg/acme.com/helper/helper.cue: -------------------------------------------------------------------------------- 1 | package helper 2 | 3 | Gotcha: "gotcha" 4 | -------------------------------------------------------------------------------- /cue/load/testdata/cue.mod/pkg/acme.com/helper/helper1.cue: -------------------------------------------------------------------------------- 1 | package helper1 2 | 3 | Gotcha: "gotcha" 4 | -------------------------------------------------------------------------------- /cue/load/testdata/cue.mod/pkg/acme.com/helper/helper2.cue: -------------------------------------------------------------------------------- 1 | package helper2 2 | 3 | Gotcha: "gotcha" 4 | -------------------------------------------------------------------------------- /cue/load/testdata/multi/file.cue: -------------------------------------------------------------------------------- 1 | // Test data - not compiled. 2 | 3 | package main 4 | 5 | {} 6 | -------------------------------------------------------------------------------- /cue/parser/corpus/+comp.cue: -------------------------------------------------------------------------------- 1 | "\(x)": y for x, y in {a: 1, b: 2} 2 | 3 | z: [ x for x in [1, 2, 3] ] 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/infra/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | #Component: "infra" 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/proxy/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | #Component: "proxy" 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/infra/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | _base: label: component: "infra" 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/mon/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | _base: label: component: "mon" 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/proxy/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | _base: label: component: "proxy" 4 | -------------------------------------------------------------------------------- /cue/load/testdata/multi/file_appengine.cue: -------------------------------------------------------------------------------- 1 | // Test data - not compiled. 2 | 3 | package test_package 4 | 5 | {} 6 | -------------------------------------------------------------------------------- /cue/load/testdata/test.cue: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import "example.org/test/sub" 4 | 5 | out: "Hello \(sub.User)!" 6 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/pkg/example.com/blocks/blocks.cue: -------------------------------------------------------------------------------- 1 | package blocks 2 | 3 | #Block: { 4 | a: >50 5 | b: <10 6 | } 7 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_filetypes.txt: -------------------------------------------------------------------------------- 1 | ! cue eval cue+date: x.cue 2 | stderr 'unknown filetype date' 3 | -- x.cue -- 4 | a: 5 -------------------------------------------------------------------------------- /cue/load/testdata/other/main.cue: -------------------------------------------------------------------------------- 1 | // Test data - not compiled. 2 | 3 | package main 4 | 5 | import ( 6 | "./file" 7 | ) 8 | 9 | {} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Add no patterns to .gitignore except for files generated by the build. 2 | cmd/cue/cue 3 | **/*.test 4 | /dist 5 | /.unity-bin 6 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/issue131.cue: -------------------------------------------------------------------------------- 1 | package ext 2 | 3 | import "example.com/blocks" 4 | 5 | #Blocks: { 6 | block1: blocks.#Block 7 | } 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/maitred/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: maitred: image: "gcr.io/myproj/maitred:v0.0.4" 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kitchen/souschef/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: souschef: image: "gcr.io/myproj/souschef:v0.5.3" 4 | -------------------------------------------------------------------------------- /codereview.cfg: -------------------------------------------------------------------------------- 1 | gerrit: https://cue-review.googlesource.com/cue 2 | github: https://github.com/cuelang/cue 3 | cue-unity: https://github.com/cue-sh/unity 4 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/bartender/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: bartender: image: "gcr.io/myproj/bartender:v0.1.34" 4 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/nested.cue: -------------------------------------------------------------------------------- 1 | // File comment. 2 | 3 | #Struct: { 4 | #T: int 5 | 6 | a?: #T 7 | 8 | {b?: #T} 9 | 10 | c?: [...#T] 11 | } 12 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/struct.cue: -------------------------------------------------------------------------------- 1 | import "struct" 2 | 3 | #MyMap: struct.MinFields(4) 4 | #MyMap: struct.MaxFields(9) 5 | 6 | #MyType: { 7 | map: #MyMap 8 | } 9 | -------------------------------------------------------------------------------- /cue/parser/corpus/+import.cue: -------------------------------------------------------------------------------- 1 | package foo 2 | 3 | import ( 4 | "time.com/now" 5 | ) 6 | 7 | 8 | foo: { 9 | bar: 3.4 10 | } 11 | 12 | a b c: [1, 2Gi, 3M] 13 | -------------------------------------------------------------------------------- /cue/testdata/resolve/002.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #skip 4 | #evalPartial 5 | -- out/legacy-debug -- 6 | <0>{x: 3, "foo-bar": 3} 7 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_hidden.txt: -------------------------------------------------------------------------------- 1 | cue eval .foo.cue 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | a: 42 6 | -- .foo.cue -- 7 | package foo 8 | 9 | a: 42 -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/go_cmd.txt: -------------------------------------------------------------------------------- 1 | # Basic sanity check that go command works as expected 2 | # within testscript tests 3 | 4 | go version 5 | stdout '^go version' 6 | 7 | -------------------------------------------------------------------------------- /cue/load/testdata/cue.mod/pkg/acme.com/catch/catch.cue: -------------------------------------------------------------------------------- 1 | package catch 2 | 3 | import "acme.com/helper:helper1" 4 | 5 | Method: "tnt" | "catapult" | "net" | helper.Gotcha 6 | -------------------------------------------------------------------------------- /cue/load/testdata/imports/imports.cue: -------------------------------------------------------------------------------- 1 | package imports 2 | 3 | import "acme.com/catch" 4 | 5 | coyoteTry1: catch.Method & "tnt" 6 | 7 | coyoteTry2: catch.Method & =~"cat" 8 | -------------------------------------------------------------------------------- /cue/load/testdata/toolonly/foo_tool.cue: -------------------------------------------------------------------------------- 1 | package foo 2 | 3 | import "tool/cli" 4 | 5 | command: foo: task: { 6 | foo: cli.Print & { 7 | text: "foo" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/host/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: host: { 4 | replicas: 2 5 | image: "gcr.io/myproj/host:v0.1.10" 6 | } 7 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/waiter/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: waiter: { 4 | image: "gcr.io/myproj/waiter:v0.3.0" 5 | replicas: 5 6 | } 7 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_loaderr.txt: -------------------------------------------------------------------------------- 1 | ! cue eval non-existing . 2 | ! stdout . 3 | cmp stderr expect-stderr 4 | 5 | -- expect-stderr -- 6 | cannot find package "non-existing" 7 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/import_dir.txt: -------------------------------------------------------------------------------- 1 | cue import -p foo ./... 2 | cmp x.cue expect.cue 3 | 4 | -- x.yml -- 5 | x: yyy 6 | -- expect.cue -- 7 | package foo 8 | 9 | x: "yyy" 10 | -------------------------------------------------------------------------------- /encoding/gocode/testdata/pkg2/instance.cue: -------------------------------------------------------------------------------- 1 | package pkg2 2 | 3 | import "strings" 4 | 5 | ImportMe: { 6 | A: <100 7 | B: strings.ContainsAny("abc") 8 | } 9 | 10 | PickMe: >5 11 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/enum.cue: -------------------------------------------------------------------------------- 1 | #CaptureMode: { 2 | "DEFAULT" 3 | #enumValue: 0 4 | } | { 5 | "IPTABLES" 6 | #enumValue: 1 7 | } | { 8 | "NONE" 9 | #enumValue: 2 10 | } 11 | -------------------------------------------------------------------------------- /encoding/protobuf/testdata/istio.io/api/cue.mod/gen/googleapis.com/acme/test/test/test_proto_gen.cue: -------------------------------------------------------------------------------- 1 | package test_test 2 | 3 | #AnotherTest: { 4 | test?: int32 @protobuf(1,int32) 5 | } 6 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/infra/download/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: download: { 4 | image: "gcr.io/myproj/download:v0.0.2" 5 | expose: port: client: 7080 6 | } 7 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/proxy/nginx/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: nginx: kubernetes: spec: { 4 | type: "LoadBalancer" 5 | loadBalancerIP: "1.3.4.5" 6 | } 7 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue236.txt: -------------------------------------------------------------------------------- 1 | cue trim 2 | 3 | -- in.cue -- 4 | package x 5 | 6 | #Schema: { 7 | optional: string 8 | } 9 | d: #Schema 10 | d: { 11 | optional: "some" 12 | } 13 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/vet_opt.txt: -------------------------------------------------------------------------------- 1 | cue vet -c vet.cue 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | -- vet.cue -- 6 | #Schema1: { 7 | a?: int 8 | } 9 | instance1: #Schema1 10 | -------------------------------------------------------------------------------- /cue/format/testdata/values.input: -------------------------------------------------------------------------------- 1 | a: 0e+1 2 | a: 0e1 3 | a: 0E+1 4 | a: 0E1 5 | a: .3e+1 6 | a: .3E+1 7 | a: .3 8 | a: 3. 9 | a: 3.T 10 | a: 3.e100 11 | 12 | 13 | s: """ 14 | x\"\"\" 15 | """ -------------------------------------------------------------------------------- /encoding/openapi/testdata/nums.cue: -------------------------------------------------------------------------------- 1 | import "math" 2 | 3 | #mul: math.MultipleOf(5) 4 | 5 | #neq: !=4 6 | 7 | #exMin: >5 8 | #exMax: <6 9 | 10 | #int: int64 11 | #intNull: int64 | null 12 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue425.txt: -------------------------------------------------------------------------------- 1 | cue vet list.cue list.json 2 | 3 | cmp stdout expect-stdout 4 | 5 | -- list.cue -- 6 | [] 7 | 8 | -- list.json -- 9 | [] 10 | 11 | -- expect-stdout -- 12 | -------------------------------------------------------------------------------- /cue/format/testdata/values.golden: -------------------------------------------------------------------------------- 1 | a: 0e+1 2 | a: 0e1 3 | a: 0e+1 4 | a: 0e1 5 | a: 0.3e+1 6 | a: 0.3e+1 7 | a: 0.3 8 | a: 3.0 9 | a: 3.0T 10 | a: 3.0e100 11 | 12 | s: """ 13 | x\"\"\" 14 | """ 15 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | _base: { 4 | name: string 5 | label: { 6 | app: name 7 | domain: "prod" 8 | component: string 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/maitred/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: maitred: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/maitred:v0.0.4" 5 | args: [ 6 | ] 7 | }] 8 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/simple.cue: -------------------------------------------------------------------------------- 1 | #MyStruct: { 2 | mediumNum: int32 3 | smallNum: int8 4 | 5 | float: float32 6 | double: float64 7 | 8 | deprecatedField: string @protobuf(5,deprecated) 9 | } 10 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/strings.cue: -------------------------------------------------------------------------------- 1 | import "strings" 2 | 3 | #MyType: { 4 | myString: strings.MinRunes(1) & strings.MaxRunes(5) 5 | 6 | myPattern: =~"foo.*bar" 7 | 8 | myAntiPattern: !~"foo.*bar" 9 | } 10 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | */ 3 | 4 | # not ignore go and cue files 5 | !cmd/ 6 | !cue/ 7 | !cuego/ 8 | !encoding/ 9 | !internal/ 10 | !pkg/ 11 | !tools/ 12 | 13 | # not ignore go module files 14 | !go.mod 15 | !go.sum 16 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/api/core/v1/register_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/api/core/v1 4 | 5 | package v1 6 | 7 | #GroupName: "" 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/bartender/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: bartender: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/bartender:v0.1.34" 5 | args: [ 6 | ] 7 | }] 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/waiter/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: waiter: spec: { 4 | replicas: 5 5 | template: spec: containers: [{ 6 | image: "gcr.io/myproj/waiter:v0.3.0" 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/dump_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import "encoding/yaml" 4 | 5 | command: dump: { 6 | task: print: { 7 | kind: "print" 8 | text: yaml.MarshalStream(objects) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/api/apps/v1/register_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/api/apps/v1 4 | 5 | package v1 6 | 7 | #GroupName: "apps" 8 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/export_expr.txt: -------------------------------------------------------------------------------- 1 | cue export data.cue -e a+c -e d.e.f --out yaml 2 | cmp stdout expect-stdout 3 | -- expect-stdout -- 4 | 4 5 | --- 6 | jam 7 | -- data.cue -- 8 | a: 1 9 | c: 3 10 | d: e: f: "jam" 11 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue526.txt: -------------------------------------------------------------------------------- 1 | cue cmd gengithub 2 | 3 | -- x.cue -- 4 | package x 5 | 6 | test: #Workflow 7 | #Workflow: 1 | [_] 8 | 9 | -- x_tool.cue -- 10 | package x 11 | 12 | command: gengithub: {} 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/waterdispatcher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: waterdispatcher: { 4 | image: "gcr.io/myproj/waterdispatcher:v0.0.48" 5 | arg: http: ":8080" 6 | arg: etcd: "etcd:2379" 7 | } 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kitchen/headchef/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: headchef: _kitchenDeployment & { 4 | image: "gcr.io/myproj/headchef:v0.2.16" 5 | volume: "secret-headchef": mountPath: "/sslcerts" 6 | } 7 | -------------------------------------------------------------------------------- /encoding/protobuf/testdata/cue.proto.out.cue: -------------------------------------------------------------------------------- 1 | package proto 2 | 3 | FieldOptions required?: bool @protobuf(1) 4 | 5 | google.protobuf.FieldOptions: { 6 | val?: string @protobuf(123456) 7 | opt?: FieldOptions @protobuf(1069) 8 | } 9 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_stdin.txt: -------------------------------------------------------------------------------- 1 | stdin stdin.cue 2 | cue eval t.cue - 3 | cmp stdout expect-stdout 4 | 5 | -- stdin.cue -- 6 | foo:3 7 | -- t.cue -- 8 | foo: int 9 | bar: 3 10 | -- expect-stdout -- 11 | foo: 3 12 | bar: 3 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/valeter/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: valeter: { 4 | image: "gcr.io/myproj/valeter:v0.0.4" 5 | arg: http: ":8080" 6 | arg: etcd: "etcd:2379" 7 | expose: port: http: 8080 8 | } 9 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/infra/download/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: download: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/download:v0.0.2" 5 | ports: [{ 6 | containerPort: 7080 7 | }] 8 | }] 9 | -------------------------------------------------------------------------------- /cue/testdata/references/embed_self.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | Foo: { 3 | } 4 | 5 | Foo 6 | -- out/eval -- 7 | (struct){ 8 | Foo: (struct){ 9 | } 10 | } 11 | -- out/compile -- 12 | --- in.cue 13 | { 14 | Foo: {} 15 | 〈0;Foo〉 16 | } 17 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kitchen/expiditer/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: expiditer: _kitchenDeployment & { 4 | image: "gcr.io/myproj/expiditer:v0.5.34" 5 | arg: "ssh-tunnel-key": "/etc/certs/tunnel-private.pem" 6 | } 7 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/api/core/v1/doc_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/api/core/v1 4 | 5 | // Package v1 is the v1 version of the core API. 6 | package v1 7 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kube_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | objects: [ for v in objectSets for x in v { x } ] 4 | 5 | objectSets: [ 6 | service, 7 | deployment, 8 | statefulSet, 9 | daemonSet, 10 | configMap, 11 | ] 12 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/fmt_stdin.txt: -------------------------------------------------------------------------------- 1 | stdin feed 2 | cue fmt - 3 | cmp stdout expect-stdout 4 | 5 | -- feed -- 6 | foo : 2 7 | a: {b: 3} // a comment 8 | -- expect-stdout -- 9 | foo: 2 10 | a: {b: 3} // a comment 11 | -- fmt/cue.mod -- 12 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/dump_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import ( 4 | "encoding/yaml" 5 | "tool/cli" 6 | ) 7 | 8 | command: dump: { 9 | task: print: cli.Print & { 10 | text: yaml.MarshalStream(objects) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/host/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: host: spec: { 4 | replicas: 2 5 | template: spec: containers: [{ 6 | image: "gcr.io/myproj/host:v0.1.10" 7 | args: [ 8 | ] 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/infra/watcher/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: watcher: spec: { 4 | type: "LoadBalancer" 5 | loadBalancerIP: "1.2.3.4." // static ip 6 | ports: [{ 7 | name: "http" 8 | }] 9 | } 10 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/embed.cue: -------------------------------------------------------------------------------- 1 | #Foo: string 2 | 3 | #LoadBalancerSettings: { 4 | {} | { 5 | consistentHash: #ConsistentHashLB 6 | b: #Foo 7 | } 8 | #ConsistentHashLB: {} | { 9 | httpHeaderName: string 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue302.txt: -------------------------------------------------------------------------------- 1 | cue trim foo.cue 2 | cmp foo.cue rewritten 3 | 4 | -- foo.cue -- 5 | package p 6 | 7 | foo?: #Foo 8 | 9 | #Foo: "hello" 10 | 11 | -- rewritten -- 12 | package p 13 | 14 | foo?: #Foo 15 | 16 | #Foo: "hello" -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/runtime/embedded_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/runtime 4 | 5 | package runtime 6 | 7 | _#encodable: _ 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/breaddispatcher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: breaddispatcher: { 4 | image: "gcr.io/myproj/breaddispatcher:v0.3.24" 5 | arg: etcd: "etcd:2379" 6 | arg: "event-server": "events:7788" 7 | } 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/infra/tasks/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: tasks: spec: { 4 | type: "LoadBalancer" 5 | loadBalancerIP: "1.2.3.4" // static ip 6 | ports: [{ 7 | port: 443 8 | name: "http" 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/proxy/goget/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: goget: spec: { 4 | type: "LoadBalancer" 5 | loadBalancerIP: "1.3.5.7" // static ip 6 | ports: [{ 7 | port: 443 8 | name: "https" 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /encoding/protobuf/testdata/acme/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package acme.test; 4 | 5 | message Test { 6 | // doc comment 7 | option (yoyo.foo) = true; // line comment 8 | 9 | option (yoyo.bar) = false; 10 | int32 test = 1; 11 | } 12 | -------------------------------------------------------------------------------- /pkg/crypto/md5/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "crypto/md5" 5 | 6 | t1: len(md5.Sum("hash me")) 7 | -- out/md5 -- 8 | t1: 16 9 | 10 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_newline.txt: -------------------------------------------------------------------------------- 1 | cue eval ./data.cue 2 | cmp stdout expect-stdout 3 | 4 | cue eval ./data.cue -o out.cue 5 | cmp out.cue expect-out.cue 6 | 7 | -- data.cue -- 8 | 3 9 | -- expect-stdout -- 10 | 3 11 | -- expect-out.cue -- 12 | 3 13 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/fmt.txt: -------------------------------------------------------------------------------- 1 | ! cue fmt ./fmt 2 | cmp stderr expect-stderr 3 | -- expect-stderr -- 4 | expected 'STRING', found '.': 5 | ./fmt/error.cue:1:9 6 | -- fmt/error.cue -- 7 | import a.b "foo" 8 | 9 | a: 2 10 | bb: 3 11 | -- fmt/cue.mod -- 12 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/proxy/goget/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: goget: { 4 | port: http: {port: 443} 5 | 6 | kubernetes: spec: { 7 | type: "LoadBalancer" 8 | loadBalancerIP: "1.3.5.7" // static ip 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kitchen/souschef/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: souschef: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/souschef:v0.5.3" 5 | }] 6 | 7 | deployment: souschef: spec: template: spec: _hasDisks: false 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/proxy/nginx/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: nginx: spec: { 4 | type: "LoadBalancer" 5 | loadBalancerIP: "1.3.4.5" 6 | ports: [{ 7 | name: "http" 8 | }, { 9 | name: "https" 10 | }] 11 | } 12 | -------------------------------------------------------------------------------- /pkg/crypto/sha1/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "crypto/sha1" 5 | 6 | t1: len(sha1.Sum("hash me")) 7 | -- out/sha1 -- 8 | t1: 20 9 | 10 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_hiddenfail.txt: -------------------------------------------------------------------------------- 1 | ! cue eval 2 | cmp stderr expect-stderr 3 | 4 | -- expect-stderr -- 5 | build constraints exclude all CUE files in .: 6 | .foo.cue: filename starts with a '.' 7 | -- .foo.cue -- 8 | package foo 9 | 10 | a: 42 11 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | on: [push] 2 | name: Test 3 | jobs: 4 | test: 5 | strategy: 6 | fail-fast: false 7 | matrix: 8 | platform: [ubuntu-latest] 9 | runs-on: ${{ matrix.platform }} 10 | steps: 11 | - run: echo Hello, world! 12 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/alias.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | let X = Y 3 | let Y = c + d 4 | 5 | a: b: X 6 | 7 | c: 5 8 | d: 6 9 | -- out/dependencies/field -- 10 | c 11 | d 12 | -- out/dependencies/all -- 13 | c 14 | d 15 | -- out/dependencies/dynamic -- 16 | c 17 | d 18 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue174.txt: -------------------------------------------------------------------------------- 1 | ! cue export ./issue174 2 | cmp stderr expect-stderr 3 | -- expect-stderr -- 4 | build constraints exclude all CUE files in ./issue174: 5 | issue174/issue174.cue: no package name 6 | -- issue174/issue174.cue -- 7 | import 'foo' 8 | 9 | a: 1 -------------------------------------------------------------------------------- /encoding/protobuf/testdata/istio.io/api/cue.mod/gen/googleapis.com/acme/test/test_proto_gen.cue: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | #Test: { 4 | // doc comment 5 | @protobuf(option (yoyo.foo)=true) // line comment 6 | @protobuf(option (yoyo.bar)=false) 7 | test?: int32 @protobuf(1,int32) 8 | } 9 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/toolonly.txt: -------------------------------------------------------------------------------- 1 | cue cmd foo 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | foo 6 | -- foo_tool.cue -- 7 | package foo 8 | 9 | import "tool/cli" 10 | 11 | command: foo: task: { 12 | foo: cli.Print & { 13 | text: "foo" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /cue/testdata/resolve/003_resolution_of_quoted_identifiers.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: resolution of quoted identifiers 4 | #skip 5 | #evalPartial 6 | -- out/legacy-debug -- 7 | <0>{"foo-bar": 2, baz: 2, a: <1>{qux: 3, "qux-quux": 3, qaz: 3}} 8 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue303.txt: -------------------------------------------------------------------------------- 1 | cue trim foo.cue 2 | cmp foo.cue rewritten 3 | 4 | -- foo.cue -- 5 | package example 6 | 7 | foo: c: true 8 | foo: #M 9 | #M: c?: bool 10 | 11 | -- rewritten -- 12 | package example 13 | 14 | foo: c: true 15 | foo: #M 16 | #M: c?: bool 17 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/no_read_stdin.txt: -------------------------------------------------------------------------------- 1 | # try to trick cue reading from a perpetually open stdin by placing a file 2 | # named '-' in the current directory. 3 | 4 | ! cue eval 5 | stdin - 6 | cmp stderr expect-stderr 7 | -- - -- 8 | -- expect-stderr -- 9 | no CUE files in . 10 | -------------------------------------------------------------------------------- /pkg/text/template/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "text/template" 5 | 6 | t1: template.Execute("{{.}}-{{.}}", "foo") 7 | -- out/template -- 8 | t1: "foo-foo" 9 | 10 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_import.txt: -------------------------------------------------------------------------------- 1 | cue eval ./in.cue 2 | cmp stdout expect-stdout 3 | -- expect-stdout -- 4 | import "list" 5 | 6 | def: { 7 | #types: list.MinItems(1) 8 | } 9 | -- in.cue -- 10 | import ( 11 | "list" 12 | ) 13 | 14 | def: #types: list.MinItems(1) 15 | 16 | -------------------------------------------------------------------------------- /tools/trim/testdata/definitions.txtar: -------------------------------------------------------------------------------- 1 | #Issue #558 2 | 3 | -- in.cue -- 4 | #Foo: { 5 | bar: int 6 | baz: 2 7 | } 8 | foo: #Foo & { 9 | bar: 1 10 | baz: 2 11 | } 12 | -- out/trim -- 13 | == in.cue 14 | #Foo: { 15 | bar: int 16 | baz: 2 17 | } 18 | foo: #Foo & { 19 | bar: 1 20 | } 21 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue322.txt: -------------------------------------------------------------------------------- 1 | ! cue vet 2 | cmp stderr expect-stderr 3 | 4 | -- expect-stderr -- 5 | imported and not used: "strings": 6 | ./x.cue:2:8 7 | -- x.cue -- 8 | package x 9 | import "strings" 10 | 11 | foo: "hello" 12 | 13 | -- y.cue -- 14 | package x 15 | 16 | bar: foo -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/types/doc_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/types 4 | 5 | // Package types implements various generic types used throughout kubernetes. 6 | package types 7 | -------------------------------------------------------------------------------- /cue/parser/corpus/+hello.cue: -------------------------------------------------------------------------------- 1 | package hello 2 | 3 | command echo: { 4 | task echo: { 5 | kind: "exec" 6 | cmd: "echo \(message)" 7 | stdout: string 8 | } 9 | 10 | task display: { 11 | kind: "print" 12 | text: task.echo.stdout 13 | } 14 | } -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kube_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | objects: [ for v in objectSets for x in v { x } ] 4 | 5 | objectSets: [ 6 | kubernetes.services, 7 | kubernetes.deployments, 8 | kubernetes.statefulSets, 9 | kubernetes.daemonSets, 10 | kubernetes.configMaps, 11 | ] 12 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/breaddispatcher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: breaddispatcher: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/breaddispatcher:v0.3.24" 5 | args: [ 6 | "-etcd=etcd:2379", 7 | "-event-server=events:7788", 8 | ] 9 | }] 10 | -------------------------------------------------------------------------------- /cue/testdata/eval/structs.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | import "struct" 3 | 4 | v: {a: struct.MaxFields(2) & {}}.a 5 | 6 | -- out/eval -- 7 | (struct){ 8 | v: (struct){ 9 | } 10 | } 11 | -- out/compile -- 12 | --- in.cue 13 | { 14 | v: { 15 | a: (〈import;struct〉.MaxFields(2) & {}) 16 | }.a 17 | } 18 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/infra/watcher/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: watcher: { 4 | kubernetes: spec: { 5 | type: "LoadBalancer" 6 | loadBalancerIP: "1.2.3.4" // static ip 7 | } 8 | ports: https: { 9 | port: 7788 10 | targetPort: 7788 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the list of CUE authors for copyright purposes. 2 | # 3 | # This does not necessarily list everyone who has contributed code, since in 4 | # some cases, their employer may be the copyright holder. To see the full list 5 | # of contributors, see the revision history in source control. 6 | Google LLC 7 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/import_match.txt: -------------------------------------------------------------------------------- 1 | cue import -p uni --with-context -l 'path.Ext(filename)' -n '.*uni.yml' ./... 2 | cmp uni.cue out/expect-uni.cue 3 | -- uni.yml -- 4 | hello: world 5 | -- service.yaml -- 6 | x: foobie 7 | -- out/expect-uni.cue -- 8 | package uni 9 | 10 | ".yml": hello: "world" 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/proxy/goget/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: goget: { 4 | image: "gcr.io/myproj/goget:v0.5.1" 5 | 6 | expose: port: https: 7443 7 | 8 | volume: "secret-volume": { 9 | mountPath: "/etc/ssl" 10 | spec: secret: secretName: "goget-secrets" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/runtime/types_proto_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/runtime 4 | 5 | package runtime 6 | 7 | #ProtobufMarshaller: _ 8 | 9 | #ProtobufReverseMarshaller: _ 10 | -------------------------------------------------------------------------------- /encoding/protobuf/testdata/acme/test/test.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package acme.test.test; 4 | 5 | // Override the short name only of this package. This notation is seen in some 6 | // gogoproto files. 7 | option go_package = "test_test" 8 | 9 | message AnotherTest { 10 | int32 test = 1; 11 | } 12 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue312.txt: -------------------------------------------------------------------------------- 1 | ! cue export x.cue -out cue 2 | cmp stderr expect-stderr 3 | 4 | ! cue export -out cue 5 | cmp stderr expect-stderr 6 | 7 | ! cue export -out x.cue 8 | cmp stderr expect-stderr 9 | 10 | -- expect-stderr -- 11 | no encoding specified for file "ut" 12 | -- x.cue -- 13 | a: 1 -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/infra/tasks/service.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: tasks: { 4 | port: https: { 5 | port: 443 6 | targetPort: 7443 7 | protocol: "TCP" 8 | } 9 | kubernetes: spec: { 10 | type: "LoadBalancer" 11 | loadBalancerIP: "1.2.3.4" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/apis/meta/v1/register_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/apis/meta/v1 4 | 5 | package v1 6 | 7 | #GroupName: "meta.k8s.io" 8 | 9 | #WatchEventKind: "WatchEvent" 10 | -------------------------------------------------------------------------------- /encoding/protobuf/textproto/testdata/decoder/scalar.txtar: -------------------------------------------------------------------------------- 1 | -- map.cue -- 2 | inf: number 3 | nan: number 4 | 5 | t: bool 6 | f: bool 7 | 8 | 9 | -- input.textproto -- 10 | inf: inf 11 | nan: nan 12 | t: true 13 | f: false 14 | 15 | -- out/decode -- 16 | inf: _|_ 17 | nan: _|_ 18 | t: true 19 | f: false 20 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_e_hidden.txt: -------------------------------------------------------------------------------- 1 | # Issue #904 2 | cue eval -e _a 3 | stdout '34' 4 | 5 | cue eval -e _a dep.cue 6 | stdout '34' 7 | 8 | cue eval -e _a tst.cue 9 | stdout '34' 10 | 11 | cue eval -H 12 | stdout '_a: 34' 13 | 14 | -- dep.cue -- 15 | package dep 16 | 17 | _a: 34 18 | -- tst.cue -- 19 | _a: 34 -------------------------------------------------------------------------------- /encoding/protobuf/testdata/istio.io/api/other/trailcomment.proto: -------------------------------------------------------------------------------- 1 | // Issue #586 2 | package foo 3 | 4 | message Bar { 5 | oneof Foo { 6 | string a = 1; 7 | // hello world 8 | 9 | string b = 2; 10 | // hello world 11 | } 12 | 13 | int32 c = 3; 14 | // hello world 15 | } 16 | -------------------------------------------------------------------------------- /encoding/protobuf/textproto/testdata/decoder/errors.txtar: -------------------------------------------------------------------------------- 1 | # The error in input.textproto (wrong comment style) is going undetected. 2 | # This is a protobuf bug. Can't do much about it. 3 | -- errors.cue -- 4 | a: int 5 | 6 | -- input.textproto -- 7 | 8 | // Silent nights 9 | a: 1 10 | 11 | -- out/decode -- 12 | 13 | -------------------------------------------------------------------------------- /cue/testdata/eval/issue295.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | p: close({ 3 | "\("f")": _ 4 | }) 5 | p: f: 9 6 | -- out/compile -- 7 | --- in.cue 8 | { 9 | p: close({ 10 | "\("f")": _ 11 | }) 12 | p: { 13 | f: 9 14 | } 15 | } 16 | -- out/eval -- 17 | (struct){ 18 | p: (#struct){ 19 | f: (int){ 9 } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cue/testdata/builtins/or.txtar: -------------------------------------------------------------------------------- 1 | // unwrap into single value 2 | unwrap: or([1, 1, 1]) 3 | 4 | // unique duplicate values 5 | unique1: or([2, 1, 1, 2]) 6 | 7 | unique2: or([{a: 1}, {a: 1}, {a: 2}]) 8 | 9 | // do not unique embedded scalars with differing values for child definitions. 10 | embed1: or([{2, #x: 1}, {2, #x: 2}]) 11 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/listcomprehension.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: b: [ for x in c if x.a > 0 { x.a + d } ] 3 | 4 | c: [{a: 1}, {a: 3}] 5 | d: 2 6 | -- out/dependencies/field -- 7 | c 8 | d 9 | -- out/dependencies/all -- 10 | c 11 | d 12 | -- out/dependencies/dynamic -- 13 | c 14 | d 15 | c[0].a 16 | d 17 | c[1].a 18 | d 19 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue749.txt: -------------------------------------------------------------------------------- 1 | cue eval ./float.cue 2 | cmp stderr expect-stderr 3 | cmp stdout expect-stdout 4 | -- float.cue -- 5 | import "strconv" 6 | 7 | x : strconv.ParseFloat("3.14", 32) 8 | y : strconv.ParseFloat("3.14", 64) 9 | 10 | -- expect-stderr -- 11 | -- expect-stdout -- 12 | x: 3.140000104904175 13 | y: 3.14 -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_tool.txt: -------------------------------------------------------------------------------- 1 | cue eval 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | message: "Hello world!" 6 | -- task.cue -- 7 | package home 8 | message: "Hello world!" 9 | 10 | -- task_tool.cue -- 11 | package home 12 | 13 | command: run_list: runBase & { 14 | task: echo: cmd: ["echo", message] 15 | } 16 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue324.txt: -------------------------------------------------------------------------------- 1 | ! cue vet foo.cue 2 | 3 | cmp stderr expect-stderr 4 | 5 | -- foo.cue -- 6 | import "encoding/yaml" 7 | 8 | x: string 9 | a: b: c: *["\(x)"] | _ 10 | d: yaml.Marshal(a.b) 11 | 12 | -- expect-stderr -- 13 | some instances are incomplete; use the -c flag to show errors or suppress this message 14 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/watch/doc_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/watch 4 | 5 | // Package watch contains a generic watchable interface, and a fake for 6 | // testing code that uses the watch interface. 7 | package watch 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/k8s_defs.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import ( 4 | "k8s.io/api/core/v1" 5 | apps_v1 "k8s.io/api/apps/v1" 6 | ) 7 | 8 | service: [string]: v1.#Service 9 | deployment: [string]: apps_v1.#Deployment 10 | daemonSet: [string]: apps_v1.#DaemonSet 11 | statefulSet: [string]: apps_v1.#StatefulSet 12 | -------------------------------------------------------------------------------- /encoding/protobuf/testdata/trailcomment.proto.out.cue: -------------------------------------------------------------------------------- 1 | // Issue #586 2 | package foo 3 | 4 | #Bar: { 5 | {} | { 6 | a: string @protobuf(1,string) 7 | 8 | // hello world 9 | 10 | } | { 11 | b: string @protobuf(2,string) 12 | 13 | // hello world 14 | 15 | } 16 | c?: int32 @protobuf(3,int32) 17 | // hello world 18 | 19 | } 20 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/infra/watcher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: watcher: { 4 | image: "gcr.io/myproj/watcher:v0.1.0" 5 | 6 | volume: "secret-volume": { 7 | mountPath: "/etc/ssl" 8 | spec: secret: secretName: "star-example-com-secrets" 9 | } 10 | port: http: 7080 11 | expose: port: https: 7788 12 | } 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/api/resource/suffix_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/api/resource 4 | 5 | package resource 6 | 7 | _#suffix: string 8 | 9 | // suffixer can interpret and construct suffixes. 10 | _#suffixer: _ 11 | -------------------------------------------------------------------------------- /cue/ast/astutil/testdata/resolve/value.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | b: X={ 3 | c: X.a 4 | } 5 | 6 | -- out/resolve/in -- 7 | 3[b]: Scope: 0[] Node: 0[] 8 | 5[X]: Scope: 0[] Node: 0[] 9 | 8[c]: Scope: 0[] Node: 0[] 10 | 9[X]: Scope: 2[*ast.Field] Node: 4[X={c: X.a}] 11 | 10[a]: Scope: 0[] Node: 0[] 12 | 13 | -------------------------------------------------------------------------------- /cue/testdata/definitions/dynamic.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | #A: { 3 | a: "foo" 4 | "\(a)": 3 5 | } 6 | 7 | -- out/eval -- 8 | (struct){ 9 | #A: (#struct){ 10 | a: (string){ "foo" } 11 | foo: (int){ 3 } 12 | } 13 | } 14 | -- out/compile -- 15 | --- in.cue 16 | { 17 | #A: { 18 | a: "foo" 19 | "\(〈0;a〉)": 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cue/testdata/eval/expressions.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: 1 3 | b: 1 + 2 4 | c: 3 - 1 5 | d: 5 rem 3 6 | 7 | -- out/eval -- 8 | (struct){ 9 | a: (int){ 1 } 10 | b: (int){ 3 } 11 | c: (int){ 2 } 12 | d: (int){ 2 } 13 | } 14 | -- out/compile -- 15 | --- in.cue 16 | { 17 | a: 1 18 | b: (1 + 2) 19 | c: (3 - 1) 20 | d: (5 rem 3) 21 | } 22 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/frontend/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | _base: label: component: "frontend" 4 | 5 | deployment: [string]: { 6 | expose: port: http: *7080 | int 7 | kubernetes: spec: template: metadata: annotations: { 8 | "prometheus.io.scrape": "true" 9 | "prometheus.io.port": "\(expose.port.http)" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/original/services/proxy/authproxy/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: authproxy 5 | labels: 6 | app: authproxy 7 | domain: prod 8 | spec: 9 | ports: 10 | - port: 4180 11 | targetPort: 4180 12 | protocol: TCP 13 | name: client 14 | selector: 15 | app: authproxy -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/runtime/conversion_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/runtime 4 | 5 | // Package runtime defines conversions between generic types and structs to map query strings 6 | // to struct objects. 7 | package runtime 8 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/types/namespacedname_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/types 4 | 5 | package types 6 | 7 | #NamespacedName: { 8 | Namespace: string 9 | Name: string 10 | } 11 | 12 | #Separator: 47 // '/' 13 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/list.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | // Note: in dynamic mode, [d] does not get picked up 3 | // because the disjunction is not resolved. 4 | a: b: [ d, ...e ] & [ 1, 2, ... ] 5 | 6 | d: int 7 | e: int 8 | -- out/dependencies/field -- 9 | -- out/dependencies/all -- 10 | d 11 | e 12 | -- out/dependencies/dynamic -- 13 | d 14 | e 15 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/ls_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import "strings" 4 | 5 | command: ls: { 6 | task: print: { 7 | kind: "print" 8 | let Lines = [ 9 | for x in objects { 10 | "\(x.kind) \t\(x.metadata.labels.component) \t\(x.metadata.name)" 11 | } 12 | ] 13 | text: strings.Join(Lines, "\n") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kitchen/expiditer/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: expiditer: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/expiditer:v0.5.34" 5 | args: [ 6 | "-env=prod", 7 | "-ssh-tunnel-key=/etc/certs/tunnel-private.pem", 8 | "-logdir=/logs", 9 | "-event-server=events:7788", 10 | ] 11 | }] 12 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue304.txt: -------------------------------------------------------------------------------- 1 | cue def -e '#Foo' x.cue 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | 6 | _#def 7 | _#def: { 8 | x: int 9 | body?: { 10 | a: int 11 | b?: string 12 | } 13 | } 14 | -- x.cue -- 15 | package example 16 | 17 | #Foo: { 18 | x: int 19 | body?: { 20 | a: int 21 | b?: string 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/vet_altdata.txt: -------------------------------------------------------------------------------- 1 | cue vet schema.cue json: foo.data 2 | ! stderr . 3 | 4 | cue export schema.cue json: foo.data 5 | cmp stdout export-stdout 6 | 7 | -- schema.cue -- 8 | [string]: string 9 | 10 | -- foo.data -- 11 | { "a": "b" } 12 | { "c": "d" } 13 | 14 | -- export-stdout -- 15 | { 16 | "a": "b", 17 | "c": "d" 18 | } 19 | -------------------------------------------------------------------------------- /cue/parser/corpus/+commas.cue: -------------------------------------------------------------------------------- 1 | package foo 2 | 3 | import "path/to/pkg" 4 | import name "path/to/pkg" 5 | import . "path/to/pkg" 6 | import /* ERROR "expected 'STRING', found newline" */ 7 | import err /* ERROR "expected 'STRING', found newline" */ 8 | 9 | foo: [ 10 | 0 // legal JSON 11 | ] 12 | 13 | bar: [ 14 | 0, 15 | 1, 16 | 2, 17 | 3 18 | ] 19 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/infra/updater/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: updater: { 4 | image: "gcr.io/myproj/updater:v0.1.0" 5 | args: ["-key=/etc/certs/updater.pem"] 6 | 7 | expose: port: http: 8080 8 | volume: "secret-updater": { 9 | mountPath: "/etc/certs" 10 | spec: secret: secretName: "updater-secrets" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/waterdispatcher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: waterdispatcher: spec: ports: [{ 4 | name: "http" 5 | }] 6 | deployment: waterdispatcher: spec: template: spec: containers: [{ 7 | image: "gcr.io/myproj/waterdispatcher:v0.0.48" 8 | args: [ 9 | "-http=:8080", 10 | "-etcd=etcd:2379", 11 | ] 12 | }] 13 | -------------------------------------------------------------------------------- /encoding/protobuf/textproto/testdata/encoder/simple.txtar: -------------------------------------------------------------------------------- 1 | -- value.cue -- 2 | a: 1 3 | b: 2 4 | c: 3.4 5 | 6 | d: "foo\u1234" 7 | e: '\000' 8 | 9 | f: false 10 | // Doc comment 11 | t: true 12 | 13 | notConcrete: string 14 | 15 | -- out/encode -- 16 | a: 1 17 | b: 2 18 | c: 3.4 19 | d: "fooሴ" 20 | e: "\x00" 21 | f: false 22 | # Doc comment 23 | t: true 24 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/watch/filter_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/watch 4 | 5 | package watch 6 | 7 | // Recorder records all events that are sent from the watch until it is closed. 8 | #Recorder: { 9 | Interface: #Interface 10 | } 11 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue477.txt: -------------------------------------------------------------------------------- 1 | ! cue cmd print 2 | 3 | cmp stderr expect-stderr 4 | 5 | -- x_tool.cue -- 6 | package x 7 | 8 | import ( 9 | "strings" 10 | "tool/cli" 11 | ) 12 | 13 | command: print: cli.Print & { 14 | text: "this is a test" 15 | } 16 | 17 | -- expect-stderr -- 18 | imported and not used: "strings": 19 | ./x_tool.cue:4:5 20 | -------------------------------------------------------------------------------- /cue/testdata/export/013.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | { 5 | a: >=0 & <=10 & !=1 6 | } 7 | -- out/def -- 8 | a: >=0 & <=10 & !=1 9 | -- out/compile -- 10 | --- in.cue 11 | { 12 | { 13 | a: ((>=0 & <=10) & !=1) 14 | } 15 | } 16 | -- out/eval -- 17 | (struct){ 18 | a: (number){ &(>=0, <=10, !=1) } 19 | } 20 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kitchen/headchef/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: headchef: spec: template: spec: containers: [{ 4 | image: "gcr.io/myproj/headchef:v0.2.16" 5 | volumeMounts: [{ 6 | }, { 7 | mountPath: "/sslcerts" 8 | }] 9 | args: [ 10 | "-env=prod", 11 | "-logdir=/logs", 12 | "-event-server=events:7788", 13 | ] 14 | }] 15 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/mod/example.com_blah_v1.0.0.txt: -------------------------------------------------------------------------------- 1 | -- .mod -- 2 | module example.com/blah 3 | 4 | -- .info -- 5 | {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 6 | 7 | -- go.mod -- 8 | module example.com/blah 9 | 10 | -- blah.go -- 11 | package blah 12 | 13 | // Some fruit 14 | const Name = "Orange" 15 | -- blah.cue -- 16 | package blah 17 | 18 | Type: "Fruit" 19 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/proxy/authproxy/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: authproxy: { 4 | image: "skippy/oauth2_proxy:2.0.1" 5 | args: ["--config=/etc/authproxy/authproxy.cfg"] 6 | 7 | expose: port: client: 4180 8 | 9 | volume: "config-volume": { 10 | mountPath: "/etc/authproxy" 11 | spec: configMap: name: "authproxy" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/composed.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | t1: {$id: "foo"} & { 3 | ref: t1.stdout 4 | cmd: ["sh", "-c", "echo hello"] 5 | stdout: string 6 | } 7 | a: b: {$id: "foo"} & { 8 | text: t1.stdout 9 | } 10 | -- out/dependencies/field -- 11 | -- out/dependencies/all -- 12 | t1.stdout 13 | -- out/dependencies/dynamic -- 14 | t1.stdout 15 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_import.txt: -------------------------------------------------------------------------------- 1 | ! cue cmd pkg 2 | cmp stderr expect-stderr 3 | 4 | -- expect-stderr -- 5 | command.pkg.t: reference "cli" not found: 6 | ./task_tool.cue:6:5 7 | -- task_tool.cue -- 8 | package home 9 | 10 | // missing imports 11 | 12 | command: pkg: { 13 | t: cli.Print & { 14 | text: "Hello world!" 15 | } 16 | } 17 | 18 | -- cue.mod -- 19 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue512.txt: -------------------------------------------------------------------------------- 1 | cue export -o bools.yaml bools.cue 2 | cue import -o bools2.cue bools.yaml 3 | cmp bools.cue bools2.cue 4 | 5 | -- bools.cue -- 6 | x: [ 7 | "n", 8 | "N", 9 | "no", 10 | "No", 11 | "NO", 12 | "y", 13 | "Y", 14 | "yes", 15 | "Yes", 16 | "YES", 17 | "off", 18 | "Off", 19 | "OFF", 20 | "on", 21 | "On", 22 | "ON", 23 | ] 24 | -------------------------------------------------------------------------------- /cue/testdata/compile/fields.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | #dev: int 3 | "#dev": int 4 | _dev: int 5 | _#dev: int 6 | -- out/compile -- 7 | --- in.cue 8 | { 9 | #dev: int 10 | "#dev": int 11 | _dev: int 12 | _#dev: int 13 | } 14 | -- out/eval -- 15 | (struct){ 16 | #dev: (int){ int } 17 | "#dev": (int){ int } 18 | _dev: (int){ int } 19 | _#dev: (int){ int } 20 | } 21 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/create_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import "encoding/yaml" 4 | 5 | command: create: { 6 | task: kube: { 7 | kind: "exec" 8 | cmd: "kubectl create --dry-run -f -" 9 | stdin: yaml.MarshalStream(objects) 10 | stdout: string 11 | } 12 | task: display: { 13 | kind: "print" 14 | text: task.kube.stdout 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/valeter/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | service: valeter: spec: ports: [{ 4 | name: "http" 5 | }] 6 | deployment: valeter: spec: template: spec: containers: [{ 7 | image: "gcr.io/myproj/valeter:v0.0.4" 8 | ports: [{ 9 | containerPort: 8080 10 | }] 11 | args: [ 12 | "-http=:8080", 13 | "-etcd=etcd:2379", 14 | ] 15 | }] 16 | -------------------------------------------------------------------------------- /encoding/protobuf/textproto/testdata/decoder/enums.txtar: -------------------------------------------------------------------------------- 1 | -- foo.cue -- 2 | #MyEnum: 3 | #Val1 | 4 | #Val2 | 5 | #Val3 6 | 7 | #Val1: 1 8 | #Val2: 2 9 | #Val3: 3 10 | 11 | a0: #MyEnum 12 | a1: [...#MyEnum] 13 | 14 | -- input.textproto -- 15 | a0: Val1 16 | a1: Val1 17 | a1: Val2 18 | a1: Val3 19 | a1: 2 20 | 21 | -- out/decode -- 22 | a0: 1 23 | a1: [1, 2, 3, 2] 24 | -------------------------------------------------------------------------------- /internal/third_party/yaml/README.md: -------------------------------------------------------------------------------- 1 | # YAML reader for CUE 2 | 3 | This yaml parser is a heavily modified version of Canonical's go-yaml parser, 4 | which in turn is a port of the [libyaml](http://pyyaml.org/wiki/LibYAML) parser. 5 | 6 | 7 | License 8 | ------- 9 | 10 | The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. 11 | 12 | -------------------------------------------------------------------------------- /cue/testdata/export/014.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | -- in.cue -- 5 | { 6 | a: >=0 & <=10 & !=1 7 | } 8 | -- out/def -- 9 | a: >=0 & <=10 & !=1 10 | -- out/compile -- 11 | --- in.cue 12 | { 13 | { 14 | a: ((>=0 & <=10) & !=1) 15 | } 16 | } 17 | -- out/eval -- 18 | (struct){ 19 | a: (number){ &(>=0, <=10, !=1) } 20 | } 21 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/incomplete.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: b: c.d | c.e | c[e] | c["d"] | c[d] 3 | 4 | c: d: 3 5 | d: "d" 6 | e: "e" 7 | -- out/dependencies/field -- 8 | c.d 9 | c 10 | c 11 | e 12 | c.d 13 | c.d 14 | -- out/dependencies/all -- 15 | c.d 16 | c 17 | c 18 | e 19 | c.d 20 | c.d 21 | -- out/dependencies/dynamic -- 22 | c.d 23 | c 24 | c 25 | e 26 | c.d 27 | c.d 28 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/self.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: b: { 3 | for x in b {} 4 | 5 | x: { 6 | c: m 7 | d: y 8 | e: f 9 | f: 1 10 | g: b.x 11 | } 12 | y: 3 13 | } 14 | 15 | m: 3 16 | -- out/dependencies/field -- 17 | -- out/dependencies/all -- 18 | m 19 | -- out/dependencies/dynamic -- 20 | m 21 | a.b.y 22 | a.b.x.f 23 | a.b 24 | -------------------------------------------------------------------------------- /internal/filetypes/test.cue: -------------------------------------------------------------------------------- 1 | file: { 2 | 3 | filename: "foo.json" 4 | encoding: "json" 5 | form: string | *"" 6 | 7 | // extensions[".json"] 8 | 9 | form: "schema" 10 | } & json 11 | 12 | // tags maps command line tags to file properties. 13 | json: { 14 | encoding: "json" 15 | form: _ 16 | if form == "schema" { 17 | interpretations: *"jsonschema" | _ 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /cue/testdata/export/000.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | "hello" 5 | -- out/def -- 6 | "hello" 7 | -- out/export -- 8 | "hello" 9 | -- out/yaml -- 10 | hello 11 | -- out/json -- 12 | "hello" 13 | -- out/legacy-debug -- 14 | "hello" 15 | -- out/compile -- 16 | --- in.cue 17 | { 18 | "hello" 19 | } 20 | -- out/eval -- 21 | (string){ "hello" } 22 | -------------------------------------------------------------------------------- /cue/testdata/export/001.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | 'hello' 5 | -- out/def -- 6 | 'hello' 7 | -- out/export -- 8 | 'hello' 9 | -- out/yaml -- 10 | hello 11 | -- out/json -- 12 | "aGVsbG8=" 13 | -- out/legacy-debug -- 14 | 'hello' 15 | -- out/compile -- 16 | --- in.cue 17 | { 18 | 'hello' 19 | } 20 | -- out/eval -- 21 | (bytes){ 'hello' } 22 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/runtime/converter_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/runtime 4 | 5 | package runtime 6 | 7 | // UnstructuredConverter is an interface for converting between interface{} 8 | // and map[string]interface representation. 9 | #UnstructuredConverter: _ 10 | -------------------------------------------------------------------------------- /cue/ast/astutil/testdata/resolve/let.txtar: -------------------------------------------------------------------------------- 1 | -- let.cue -- 2 | b: X 3 | let X = int 4 | a: X 5 | 6 | -- out/resolve/let -- 7 | 3[b]: Scope: 0[] Node: 0[] 8 | 4[X]: Scope: 1[*ast.File] Node: 5[let X=int] 9 | 6[X]: Scope: 0[] Node: 0[] 10 | 7[int]: Scope: 0[] Node: 0[] 11 | 9[a]: Scope: 0[] Node: 0[] 12 | 10[X]: Scope: 1[*ast.File] Node: 5[let X=int] 13 | 14 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/original/services/proxy/goget/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: goget 5 | labels: 6 | app: goget 7 | component: proxy 8 | spec: 9 | type: LoadBalancer 10 | loadBalancerIP: 1.3.5.7 # static ip 11 | ports: 12 | - port: 443 13 | targetPort: 7443 14 | protocol: TCP 15 | name: https 16 | selector: 17 | app: goget -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/export.txt: -------------------------------------------------------------------------------- 1 | cue export ./hello 2 | cmp stdout expect-stdout 3 | -- expect-stdout -- 4 | { 5 | "$type": "demo", 6 | "message": "Hello World!" 7 | } 8 | -- hello/data.cue -- 9 | package hello 10 | 11 | #who: "World" 12 | -- hello/hello.cue -- 13 | package hello 14 | 15 | $type: "demo" 16 | message: "Hello \(#who)!" // who declared in data.cue 17 | -- hello/cue.mod -- 18 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kitchen/dishwasher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: dishwasher: _kitchenDeployment & { 4 | replicas: 5 5 | image: "gcr.io/myproj/dishwasher:v0.2.13" 6 | arg: "ssh-tunnel-key": "/etc/certs/tunnel-private.pem" 7 | volume: "secret-ssh-key": { 8 | mountPath: "/sslcerts" 9 | readOnly: true 10 | spec: secret: secretName: "secrets" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kitchen/linecook/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: linecook: _kitchenDeployment & { 4 | image: "gcr.io/myproj/linecook:v0.1.42" 5 | volume: "secret-linecook": name: "secret-kitchen" 6 | 7 | arg: name: "linecook" 8 | arg: etcd: "etcd:2379" 9 | arg: "reconnect-delay": "1h" 10 | arg: "-recovery-overlap": "100000" 11 | } 12 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/original/services/infra/tasks/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: tasks 5 | labels: 6 | app: tasks 7 | component: infra 8 | spec: 9 | type: LoadBalancer 10 | loadBalancerIP: 1.2.3.4 # static ip 11 | ports: 12 | - port: 443 13 | targetPort: 7443 14 | protocol: TCP 15 | name: http 16 | selector: 17 | app: tasks 18 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/structcomprehension.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: b: { 3 | for i, x in c 4 | let y = x 5 | if y > 0 { 6 | "\(e)\(i)": x + d 7 | } 8 | } 9 | 10 | c: [1, 2] 11 | d: 2 12 | e: "t" 13 | -- out/dependencies/field -- 14 | c 15 | e 16 | -- out/dependencies/all -- 17 | c 18 | e 19 | d 20 | -- out/dependencies/dynamic -- 21 | c 22 | e 23 | c[0] 24 | d 25 | c[1] 26 | d 27 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/create_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import ( 4 | "encoding/yaml" 5 | "tool/exec" 6 | "tool/cli" 7 | ) 8 | 9 | command: create: { 10 | task: kube: exec.Run & { 11 | cmd: "kubectl create --dry-run -f -" 12 | stdin: yaml.MarshalStream(objects) 13 | stdout: string 14 | } 15 | 16 | task: display: cli.Print & { 17 | text: task.kube.stdout 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/frontend/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | #Component: "frontend" 4 | 5 | deployment: [string]: spec: template: { 6 | metadata: annotations: { 7 | "prometheus.io.scrape": "true" 8 | "prometheus.io.port": "\(spec.containers[0].ports[0].containerPort)" 9 | } 10 | spec: containers: [{ 11 | ports: [{containerPort: *7080 | int}] // 7080 is the default 12 | }] 13 | } 14 | -------------------------------------------------------------------------------- /cue/testdata/references/labelstop.txtar: -------------------------------------------------------------------------------- 1 | TODO: add matching when bulk optional fields are allowed 2 | alongside other fields. 3 | -- in.cue -- 4 | {[X=string]: baz: X} 5 | bar: {} 6 | -- out/eval -- 7 | (struct){ 8 | bar: (struct){ 9 | baz: (string){ "bar" } 10 | } 11 | } 12 | -- out/compile -- 13 | --- in.cue 14 | { 15 | { 16 | [string]: { 17 | baz: 〈1;-〉 18 | } 19 | } 20 | bar: {} 21 | } 22 | -------------------------------------------------------------------------------- /cue/testdata/references/optional.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: { 3 | foo?: int 4 | 5 | b: foo 6 | } 7 | -- out/compile -- 8 | --- in.cue 9 | { 10 | a: { 11 | foo?: int 12 | b: 〈0;foo〉 13 | } 14 | } 15 | -- out/eval -- 16 | (struct){ 17 | a: (struct){ 18 | b: (_|_){ 19 | // [incomplete] a.b: cannot reference optional field: foo: 20 | // ./in.cue:4:8 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /encoding/protobuf/textproto/testdata/encoder/list.txtar: -------------------------------------------------------------------------------- 1 | -- value.cue -- 2 | // List comment 3 | intList: [ 1, 2, 3 ] 4 | 5 | structList: [{ 6 | foo: 1 7 | bar: 2 8 | }, { 9 | foo: 3 10 | bar: 4 11 | }] 12 | -- out/encode -- 13 | # List comment 14 | intList: 1 15 | intList: 2 16 | intList: 3 17 | structList: { 18 | foo: 1 19 | bar: 2 20 | } 21 | structList: { 22 | foo: 3 23 | bar: 4 24 | } 25 | -------------------------------------------------------------------------------- /cue/scanner/corpus/+tokens.cue: -------------------------------------------------------------------------------- 1 | \ufeff 2 | , 3 | foo 4 | _foo 5 | 123 6 | 1.2 7 | 'x' 8 | _|_ 9 | "x" 10 | #'x'# 11 | """ 12 | foo 13 | "" 14 | +-*/% 15 | &| 16 | && 17 | || 18 | <- 19 | -> 20 | == 21 | < 22 | > 23 | = 24 | ! 25 | != 26 | <= 27 | >= 28 | := 29 | ... 30 | ( 31 | [ 32 | [[ 33 | { 34 | {{ 35 | . 36 | ) 37 | ] 38 | ]] 39 | } 40 | }} 41 | : 42 | ; 43 | true 44 | false 45 | null 46 | for 47 | if 48 | let 49 | in -------------------------------------------------------------------------------- /encoding/protobuf/cue/cue.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package cue; 4 | 5 | import "google/protobuf/descriptor.proto"; 6 | 7 | option go_package = "cuelang.org/cueproto"; 8 | option java_package = "org.cuelang.cueproto"; 9 | 10 | message FieldOptions { 11 | bool required = 1; 12 | } 13 | 14 | extend google.protobuf.FieldOptions { 15 | string val = 123456; 16 | FieldOptions opt = 1069; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/call.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | import "encoding/json" 3 | 4 | // The reference to string needs to be included even for Visit. 5 | a: b: json.Marshal({ #a: str }) 6 | 7 | str: "x:y:z" 8 | -- out/dependencies/field -- 9 | "encoding/json".Marshal 10 | str 11 | -- out/dependencies/all -- 12 | "encoding/json".Marshal 13 | str 14 | -- out/dependencies/dynamic -- 15 | "encoding/json".Marshal 16 | str 17 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/export_select.txt: -------------------------------------------------------------------------------- 1 | cue export .:foo example.org/bar:baz 2 | 3 | cmp stdout expect-stdout 4 | -- cue.mod/module.cue -- 5 | 6 | -- foo.cue -- 7 | package foo 8 | 9 | a: 1 10 | 11 | -- bar.cue -- 12 | package bar 13 | 14 | b: 1 15 | 16 | -- expect-stdout -- 17 | { 18 | "a": 1 19 | } 20 | { 21 | "c": 1 22 | } 23 | -- cue.mod/gen/example.org/bar/bar.cue -- 24 | package baz 25 | 26 | c:1 27 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue398.txt: -------------------------------------------------------------------------------- 1 | cue eval ./pkg:foo 2 | cmp stdout expect-stdout 3 | -- cue.mod/module.cue -- 4 | module: "example.com" 5 | -- pkg/foo.cue -- 6 | package foo 7 | import "example.com/pkg:bar" 8 | bar 9 | z: 3 10 | -- pkg/bar.cue -- 11 | package bar 12 | import "example.com/pkg:baz" 13 | baz 14 | y: 2 15 | -- pkg/baz.cue -- 16 | package baz 17 | x: 1 18 | -- expect-stdout -- 19 | z: 3 20 | y: 2 21 | x: 1 22 | -------------------------------------------------------------------------------- /pkg/crypto/sha512/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "crypto/sha512" 5 | 6 | t1: len(sha512.Sum512("hash me")) 7 | t2: len(sha512.Sum384("hash me")) 8 | t3: len(sha512.Sum512_224("hash me")) 9 | t4: len(sha512.Sum512_256("hash me")) 10 | -- out/sha512 -- 11 | t1: 64 12 | t2: 48 13 | t3: 28 14 | t4: 32 15 | 16 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_closed.txt: -------------------------------------------------------------------------------- 1 | cue cmd run 2 | 3 | -- task.cue -- 4 | package ci 5 | 6 | // Must have 7 | // - indirection through definition 8 | // - unification of two list elements 9 | // - one of those elements must be _ 10 | // - Must use merge and unify tool file 11 | 12 | workflows: #Workflow 13 | 14 | #Workflow: ["a"] & [_] 15 | 16 | -- task_tool.cue -- 17 | package ci 18 | 19 | command: run: { 20 | } 21 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/fmt_err.txt: -------------------------------------------------------------------------------- 1 | # ignore certain errors for cue fmt 2 | cue fmt x.cue 3 | 4 | # Issue #644 5 | cue fmt ./... 6 | 7 | cmp x.cue out/x_cue 8 | -- cue.mod/module.cue -- 9 | module: "example.com/x" 10 | -- x.cue -- 11 | package x 12 | 13 | import "blah.com/rubbish" 14 | 15 | x: 5 16 | y: unresolved 17 | -- out/x_cue -- 18 | package x 19 | 20 | import "blah.com/rubbish" 21 | 22 | x: 5 23 | y: unresolved 24 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/refs.cue: -------------------------------------------------------------------------------- 1 | #Keep: { 2 | // This comment is included 3 | excludedStruct: #ExcludedStruct 4 | excludedInt: #ExcludedInt 5 | } 6 | 7 | // ExcludedStruct is not included in the output. 8 | #ExcludedStruct: { 9 | A: int 10 | } 11 | 12 | // ExcludedInt is not included in the output. 13 | #ExcludedInt: int 14 | 15 | #Type: { 16 | a?: string 17 | #BaseType 18 | } 19 | #BaseType: { 20 | b: string 21 | } 22 | -------------------------------------------------------------------------------- /tools/trim/testdata/listaccept.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | deployment: [ID=_]: { 3 | containers: [{}] 4 | } 5 | 6 | deployment: bartender: { 7 | containers: [{ 8 | image: "gcr.io/myproj/bartender:v0.1.34" 9 | }] 10 | } 11 | -- out/trim -- 12 | == in.cue 13 | deployment: [ID=_]: { 14 | containers: [{}] 15 | } 16 | 17 | deployment: bartender: { 18 | containers: [{ 19 | image: "gcr.io/myproj/bartender:v0.1.34" 20 | }] 21 | } 22 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue315.txt: -------------------------------------------------------------------------------- 1 | ! cue vet -c file.cue 2 | 3 | cmp stderr expect-stderr 4 | 5 | -- expect-stderr -- 6 | invalid interpolation: non-concrete value string (type string): 7 | ./file.cue:12:1 8 | -- file.cue -- 9 | #X: { 10 | x: string 11 | y: string 12 | z: string 13 | } 14 | 15 | #X: { 16 | x: "x" 17 | z: "z" 18 | } 19 | 20 | """ 21 | hello 22 | world 23 | \(#X.x) 24 | \(#X.y) 25 | \(#X.z) 26 | """ 27 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/original/services/infra/watcher/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: watcher 5 | labels: 6 | app: watcher 7 | component: infra 8 | domain: prod 9 | spec: 10 | type: LoadBalancer 11 | loadBalancerIP: 1.2.3.4. # static ip 12 | ports: 13 | - port: 7788 14 | targetPort: 7788 15 | protocol: TCP 16 | name: http 17 | selector: 18 | app: watcher 19 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/runtime/negotiate_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/runtime 4 | 5 | package runtime 6 | 7 | // NegotiateError is returned when a ClientNegotiator is unable to locate 8 | // a serializer for the requested operation. 9 | #NegotiateError: { 10 | ContentType: string 11 | Stream: bool 12 | } 13 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_notool2.txt: -------------------------------------------------------------------------------- 1 | ! cue notool 2 | ! stdout . 3 | cmp stderr cmd_baddisplay.out 4 | 5 | -- cmd_baddisplay.out -- 6 | command "notool" is not defined 7 | Ensure commands are defined in a "_tool.cue" file. 8 | Run 'cue help' to show available commands. 9 | -- task.cue -- 10 | package home 11 | message: "Hello world!" 12 | 13 | command: notool: { 14 | task: display: { 15 | kind: "print" 16 | text: 42 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue217.txt: -------------------------------------------------------------------------------- 1 | cue eval 2 | cmp stdout eval-stdout 3 | 4 | cue def 5 | cmp stdout def-stdout 6 | 7 | -- schema.cue -- 8 | package tst 9 | 10 | x: { 11 | a: #A 12 | b: #A 13 | } 14 | 15 | #A: string | [#A] 16 | 17 | -- def-stdout -- 18 | package tst 19 | 20 | x: { 21 | a: #A 22 | b: #A 23 | } 24 | #A: string | [#A] 25 | -- eval-stdout -- 26 | x: { 27 | a: string 28 | b: string 29 | } 30 | #A: string 31 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/vet.txt: -------------------------------------------------------------------------------- 1 | ! cue vet 2 | cmp stderr expect-stderr 3 | 4 | -- expect-stderr -- 5 | some instances are incomplete; use the -c flag to show errors or suppress this message 6 | -- partial.cue -- 7 | package partial 8 | 9 | def: *1 | int 10 | sum: 1 | 2 11 | 12 | b: { 13 | idx: a[str] // should resolve to top-level `a` 14 | str: string 15 | } 16 | b: a: b: 4 17 | a: { 18 | b: 3 19 | c: 4 20 | } 21 | c: b & {str: "b"} 22 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_tags.txt: -------------------------------------------------------------------------------- 1 | cue eval -t env=staging -t name=bar 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | var: { 6 | env: "staging" 7 | name: "bar" 8 | } 9 | -- tags.cue -- 10 | package tags 11 | 12 | 13 | var: env: "prod" | "staging" @tag(env,short=prod|staging) 14 | var: name: string @tag(name) 15 | 16 | // This is prohibited as for now. 17 | // foo: [string]: string @tag(all) 18 | // foo: bar: string 19 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/array.cue: -------------------------------------------------------------------------------- 1 | import "list" 2 | 3 | #Arrays: { 4 | bar?: [...#MyEnum] 5 | foo?: [...#MyStruct] 6 | 7 | baz?: list.UniqueItems() 8 | 9 | qux?: list.MinItems(1) & list.MaxItems(3) 10 | } 11 | 12 | #Arrays: { 13 | bar?: [...#MyEnum] 14 | foo?: [...#MyStruct] 15 | } 16 | 17 | // MyStruct 18 | #MyStruct: { 19 | a?: int 20 | e?: [...#MyEnum] 21 | e?: [...#MyEnum] 22 | } 23 | 24 | // MyEnum 25 | #MyEnum: *"1" | "2" | "3" 26 | -------------------------------------------------------------------------------- /pkg/crypto/sha256/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "crypto/sha256" 5 | 6 | t1: sha256.Sum256("hash me") 7 | t2: len(sha256.Sum256("hash me")) 8 | t3: len(sha256.Sum224("hash me")) 9 | -- out/sha256 -- 10 | t1: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)\xd3Ҧ\x1eFl\xfc\x0f\xed\xb5\x17\xad\xd81\xec\xacR5\xe1کc\xd6' 11 | t2: 32 12 | t3: 28 13 | 14 | -------------------------------------------------------------------------------- /cue/testdata/export/032.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | { 5 | [string]: _ 6 | foo: 3 7 | } 8 | -- out/def -- 9 | foo: 3 10 | ... 11 | -- out/export -- 12 | foo: 3 13 | -- out/yaml -- 14 | foo: 3 15 | -- out/json -- 16 | {"foo":3} 17 | -- out/compile -- 18 | --- in.cue 19 | { 20 | { 21 | [string]: _ 22 | foo: 3 23 | } 24 | } 25 | -- out/eval -- 26 | (struct){ 27 | foo: (int){ 3 } 28 | } 29 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/apis/meta/v1/duration_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/apis/meta/v1 4 | 5 | package v1 6 | 7 | // Duration is a wrapper around time.Duration which supports correct 8 | // marshaling to YAML and JSON. In particular, it marshals into strings, which 9 | // can be used as map keys in json. 10 | #Duration: _ 11 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue289.txt: -------------------------------------------------------------------------------- 1 | # TODO: error message could be improved. 2 | 3 | ! cue import test.yaml -p kube -l 'strings.ToCamel(kind)' -l metadata.name -f 4 | cmp stderr expect-stderr 5 | 6 | -- test.yaml -- 7 | apiVersion: v1 8 | kind: Service 9 | metadata: 10 | name: ingress-nginx 11 | spec: 12 | type: NodePort 13 | --- 14 | # EMPTY FILE 15 | -- expect-stderr -- 16 | error evaluating label strings.ToCamel(kind): reference "kind" not found 17 | -------------------------------------------------------------------------------- /cue/format/testdata/imports.golden: -------------------------------------------------------------------------------- 1 | package foo 2 | 3 | import ( 4 | "cuelang.org/go/foo" 5 | "cuelang.org/go/bar" 6 | "time" 7 | ) 8 | 9 | import ( 10 | time1 "time" 11 | 12 | // comment f2 13 | f2 "cuelang.org/go/foo" 14 | f1 "cuelang.org/go/foo" 15 | ) 16 | 17 | import ( 18 | time2 "time" 19 | 20 | same "cuelang.org/go/foo" // comment 1 21 | same2 "cuelang.org/go/foo" // comment 2 22 | ) 23 | 24 | a: time.time 25 | b: foo.foo 26 | c: bar.Bar 27 | -------------------------------------------------------------------------------- /encoding/protobuf/jsonpb/testdata/encoder/struct.txtar: -------------------------------------------------------------------------------- 1 | -- schema.cue -- 2 | a: { 3 | {b: int @protobuf(1,int64)} 4 | 5 | c: int @protobuf(1,int64) 6 | 7 | {d: int @protobuf(1,int32)} 8 | 9 | e: int @protobuf(1,int32) 10 | 11 | } 12 | -- value.cue -- 13 | // Hello 14 | a: { 15 | b: 1 16 | c: 2 17 | d: 3 18 | e: 4 19 | } 20 | 21 | -- out/jsonpb -- 22 | // Hello 23 | a: { 24 | b: "1" 25 | c: "2" 26 | d: 3 27 | e: 4 28 | } 29 | -------------------------------------------------------------------------------- /tools/flow/testdata/failure.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | root: { 3 | a: { 4 | $id: "failure" 5 | val: "foo" 6 | out: string 7 | } 8 | b: { 9 | $id: "valToOut" 10 | $after: a 11 | val: "bar" 12 | out: string 13 | } 14 | } 15 | -- out/run/errors -- 16 | error: task failed: failure 17 | -- out/run/t0 -- 18 | graph TD 19 | t0("root.a [Ready]") 20 | t1("root.b [Waiting]") 21 | t1-->t0 22 | 23 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_env.txt: -------------------------------------------------------------------------------- 1 | env TESTNUM=10 2 | env MYTEXT=World 3 | cue cmd env 4 | cmp stdout cmd_env.out 5 | -- cmd_env.out -- 6 | Hello World! 7 | -- task_tool.cue -- 8 | package home 9 | 10 | import ( 11 | "tool/os" 12 | "tool/cli" 13 | ) 14 | 15 | command: env: { 16 | env: os.Getenv & { 17 | TESTNUM: *<10 | string 18 | MYTEXT: string 19 | } 20 | print: cli.Print & { 21 | text: "Hello \(env.MYTEXT)!" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /encoding/jsonschema/testdata/err.txtar: -------------------------------------------------------------------------------- 1 | -- type.json -- 2 | { 3 | "type": "object", 4 | 5 | "properties": { 6 | "multi": { 7 | "type": [ "integer" ], 8 | "minimum": 2, 9 | "maximum": 3, 10 | "maxLength": 5 11 | } 12 | }, 13 | "additionalProperties": false 14 | } 15 | 16 | -- out.err -- 17 | constraint not allowed because type string is excluded: 18 | type.json:9:9 19 | -- out.cue -- 20 | multi?: int & >=2 & <=3 21 | -------------------------------------------------------------------------------- /encoding/protobuf/jsonpb/testdata/encoder/list.txtar: -------------------------------------------------------------------------------- 1 | -- schema.cue -- 2 | a: [...#D] 3 | 4 | #D: { 5 | a: int @protobuf(1,int64) 6 | } 7 | 8 | b: [1, ...] // Don't include schema fields if not in value 9 | 10 | c: [{a: 1}, ...] 11 | c: [...#D] 12 | 13 | -- value.cue -- 14 | // Hello 15 | a: [ 16 | {a: 1}, 17 | ] 18 | 19 | c: [{a: 1}, {a: 2}] 20 | 21 | -- out/jsonpb -- 22 | // Hello 23 | a: [ 24 | {a: "1"}, 25 | ] 26 | 27 | c: [{a: "1"}, {a: "2"}] 28 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_errcode.txt: -------------------------------------------------------------------------------- 1 | ! cue cmd errcode 2 | ! stdout . 3 | stderr '^task failed: command "ls --badflags" failed: exit status [12]$' 4 | 5 | -- task.cue -- 6 | package home 7 | message: "Hello world!" 8 | 9 | -- task_tool.cue -- 10 | package home 11 | 12 | import "tool/exec" 13 | 14 | command: errcode: { 15 | task: bad: exec.Run & { 16 | kind: "exec" 17 | cmd: "ls --badflags" 18 | stderr: string // suppress error message 19 | }} 20 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_tags.txt: -------------------------------------------------------------------------------- 1 | cue cmd -t prod -t name=bar tag tags.cue tags_tool.cue 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | prod: bar 6 | -- tags.cue -- 7 | package tags 8 | 9 | var: env: "prod" | "staging" @tag(env,short=prod|staging) 10 | var: name: string @tag(name) 11 | 12 | -- tags_tool.cue -- 13 | package tags 14 | 15 | import "tool/cli" 16 | 17 | command: tag: cli.Print & { 18 | text: "\(var.env): \(var.name)" 19 | } 20 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_concrete.txt: -------------------------------------------------------------------------------- 1 | cue eval -c -a 2 | cmp stdout eval_conc.cue 3 | 4 | cue eval --out yaml 5 | cmp stdout eval_conc.yaml 6 | 7 | -- eval_conc.cue -- 8 | message: "Hello World!" 9 | -- eval_conc.yaml -- 10 | message: Hello World! 11 | -- cmd_echo.out -- 12 | Hello World! 13 | 14 | -- data.cue -- 15 | package hello 16 | 17 | #who: "World" 18 | -- hello.cue -- 19 | package hello 20 | 21 | message: "Hello \(#who)!" // who declared in data.cue 22 | -------------------------------------------------------------------------------- /cue/testdata/cycle/cycle_with_bounds.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | #Value: int 3 | 4 | foo: #Value 5 | foo: != bar 6 | bar: #Value 7 | bar: != foo 8 | 9 | bar: 0 10 | foo: 1 11 | -- out/compile -- 12 | --- in.cue 13 | { 14 | #Value: int 15 | foo: 〈0;#Value〉 16 | foo: !=〈0;bar〉 17 | bar: 〈0;#Value〉 18 | bar: !=〈0;foo〉 19 | bar: 0 20 | foo: 1 21 | } 22 | -- out/eval -- 23 | (struct){ 24 | #Value: (int){ int } 25 | foo: (int){ 1 } 26 | bar: (int){ 0 } 27 | } 28 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/cycle.json: -------------------------------------------------------------------------------- 1 | { 2 | "openapi": "3.0.0", 3 | "info": { 4 | "title": "test", 5 | "version": "v1" 6 | }, 7 | "paths": {}, 8 | "components": { 9 | "schemas": { 10 | "Foo": { 11 | "description": "Issue #915", 12 | "type": "object", 13 | "additionalProperties": { 14 | "$ref": "#/components/schemas/Foo" 15 | } 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /encoding/openapi/testdata/enum.json: -------------------------------------------------------------------------------- 1 | { 2 | "openapi": "3.0.0", 3 | "info": { 4 | "title": "Generated by cue.", 5 | "version": "no version" 6 | }, 7 | "paths": {}, 8 | "components": { 9 | "schemas": { 10 | "CaptureMode": { 11 | "type": "string", 12 | "enum": [ 13 | "DEFAULT", 14 | "IPTABLES", 15 | "NONE" 16 | ] 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/types/uid_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/types 4 | 5 | package types 6 | 7 | // UID is a type that holds unique ID values, including UUIDs. Because we 8 | // don't ONLY use UUIDs, this is an alias to string. Being a type captures 9 | // intent and helps make sure that UIDs and names do not get conflated. 10 | #UID: string 11 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/ls_tool.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | import ( 4 | "text/tabwriter" 5 | "tool/cli" 6 | "tool/file" 7 | ) 8 | 9 | command: ls: { 10 | task: print: cli.Print & { 11 | text: tabwriter.Write([ 12 | for x in objects { 13 | "\(x.kind) \t\(x.metadata.labels.component) \t\(x.metadata.name)" 14 | } 15 | ]) 16 | } 17 | 18 | task: write: file.Create & { 19 | filename: "foo.txt" 20 | contents: task.print.text 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/expr.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | // Note: in dynamic mode, [d] does not get picked up 3 | // because the disjunction is not resolved. 4 | a: b: "\(d)" | -d | c[:1] | c[0] | 0) | false { 18 | command: ["foo", "bar"] 19 | } 20 | } 21 | -- hello/cue.mod -- 22 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/merge_interaction.txt: -------------------------------------------------------------------------------- 1 | cue cmd dump 2 | 3 | cmp stdout expect-stdout 4 | 5 | -- combine.cue -- 6 | package kube 7 | 8 | map: [string]: spec: {} 9 | map: bartender: {} 10 | 11 | -- combine_tool.cue -- 12 | package kube 13 | 14 | import ( 15 | "encoding/yaml" 16 | "tool/cli" 17 | ) 18 | 19 | objects: [ for x in map {x}] 20 | 21 | command: dump: { 22 | cli.Print & { 23 | text: yaml.MarshalStream(objects) 24 | } 25 | } 26 | -- cue.mod -- 27 | 28 | -- expect-stdout -- 29 | spec: {} 30 | 31 | -------------------------------------------------------------------------------- /cue/testdata/packages/issue398.txtar: -------------------------------------------------------------------------------- 1 | -- cue.mod/module.cue -- 2 | module: "example.com" 3 | -- foo.cue -- 4 | package foo 5 | import "example.com/pkg:bar" 6 | bar 7 | zz: 3 8 | -- pkg/bar.cue -- 9 | package bar 10 | import "example.com/pkg:baz" 11 | baz 12 | yy: 2 13 | -- pkg/baz.cue -- 14 | package baz 15 | xx: 1 16 | -- out/eval -- 17 | (struct){ 18 | xx: (int){ 1 } 19 | yy: (int){ 2 } 20 | zz: (int){ 3 } 21 | } 22 | -- out/compile -- 23 | --- foo.cue 24 | { 25 | 〈import;"example.com/pkg:bar"〉 26 | zz: 3 27 | } 28 | -------------------------------------------------------------------------------- /doc/cmd/cue.md: -------------------------------------------------------------------------------- 1 | # `cue` command reference 2 | 3 | `cue help` gives information about the various `cue` commands available, as well 4 | as additional help topics. For example `cue help import` gives information about 5 | how to convert other formats like JSON and YAML to CUE, and `cue help filetypes` 6 | describes the `cue` command's support for various file types. 7 | 8 | We do plan to provide a web-based version of these various help topics, 9 | something that is tracked by [#9](https://github.com/cuelang/cue/issues/9). 10 | -------------------------------------------------------------------------------- /encoding/protobuf/jsonpb/testdata/encoder/simple.txtar: -------------------------------------------------------------------------------- 1 | -- value.cue -- 2 | a: 1 @protobuf(1, int64) 3 | b: 2 @protobuf(1, int32) 4 | c: 3.4 @protobuf(1, int64) 5 | 6 | d: "foo\u1234" 7 | e: '\000' 8 | 9 | f: false 10 | // Doc comment 11 | t: true 12 | 13 | notConcrete: string 14 | 15 | -- out/jsonpb -- 16 | a: "1" @protobuf(1, int64) 17 | b: 2 @protobuf(1, int32) 18 | c: 3.4 @protobuf(1, int64) 19 | 20 | d: "foo\u1234" 21 | e: '\000' 22 | 23 | f: false 24 | // Doc comment 25 | t: true 26 | 27 | notConcrete: string 28 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_issue650.txt: -------------------------------------------------------------------------------- 1 | cue cmd test 2 | 3 | -- blah/blah.cue -- 4 | package blah 5 | 6 | #Pod: { 7 | spec?: #PodSpec 8 | } 9 | 10 | #PodSpec: { 11 | } 12 | -- cue.mod/module.cue -- 13 | module: "mod.com" 14 | -- x_tool.cue -- 15 | package kube 16 | 17 | import ( 18 | "tool/cli" 19 | "mod.com/blah" 20 | ) 21 | 22 | root: blah.#Pod 23 | 24 | root: spec: _ 25 | 26 | command: test: task: test: cli.Print & { 27 | for _ in root { 28 | text: "success" 29 | } 30 | } 31 | -- y_tool.cue -- 32 | package kube -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue116.txt: -------------------------------------------------------------------------------- 1 | stdin in 2 | cue import yaml: - 3 | cmp stdout stdout-cue1 4 | 5 | stdin in 6 | cue export yaml: - 7 | cmp stdout stdout-json 8 | 9 | stdin in 10 | cue eval yaml: - 11 | cmp stdout stdout-cue2 12 | 13 | stdin in 14 | cue def yaml: - 15 | cmp stdout stdout-cue3 16 | 17 | -- in -- 18 | foo: bar 19 | -- stdout-cue1 -- 20 | foo: "bar" 21 | -- stdout-cue2 -- 22 | foo: "bar" 23 | -- stdout-cue3 -- 24 | foo: "bar" 25 | -- stdout-json -- 26 | { 27 | "foo": "bar" 28 | } 29 | -- dummy -- 30 | -------------------------------------------------------------------------------- /cue/testdata/resolve/000_convert___to_top.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: convert _ to top 4 | #evalPartial 5 | -- in.cue -- 6 | a: {[_]: _} 7 | -- out/def -- 8 | a: { 9 | ... 10 | } 11 | -- out/export -- 12 | a: {} 13 | -- out/yaml -- 14 | a: {} 15 | -- out/json -- 16 | {"a":{}} 17 | -- out/legacy-debug -- 18 | <0>{a: <1>{...}} 19 | -- out/compile -- 20 | --- in.cue 21 | { 22 | a: { 23 | [_]: _ 24 | } 25 | } 26 | -- out/eval -- 27 | (struct){ 28 | a: (struct){ 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/apis/meta/v1 4 | 5 | package v1 6 | 7 | #RFC3339Micro: "2006-01-02T15:04:05.000000Z07:00" 8 | 9 | // MicroTime is version of Time with microsecond level precision. 10 | // 11 | // +protobuf.options.marshal=false 12 | // +protobuf.as=Timestamp 13 | // +protobuf.options.(gogoproto.goproto_stringer)=false 14 | #MicroTime: _ 15 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/infra/updater/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: updater: spec: template: spec: { 4 | volumes: [{ 5 | name: "secret-updater" 6 | secret: secretName: "updater-secrets" 7 | }] 8 | containers: [{ 9 | image: "gcr.io/myproj/updater:v0.1.0" 10 | volumeMounts: [{ 11 | mountPath: "/etc/certs" 12 | name: "secret-updater" 13 | }] 14 | 15 | ports: [{ 16 | containerPort: 8080 17 | }] 18 | args: [ 19 | "-key=/etc/certs/updater.pem", 20 | ] 21 | }] 22 | } 23 | -------------------------------------------------------------------------------- /doc/tutorial/basics/Readme.md: -------------------------------------------------------------------------------- 1 | # CUE Tour 2 | 3 | ## About this tutorial 4 | 5 | The files in this directory are used to generate the tour in 6 | 7 | https://cuelang.org/docs/tutorials/tour/intro/ 8 | 9 | They are kept here to ensure the examples are in sync with the latest update 10 | of CUE. 11 | 12 | To try out the examples in the tutorial you can follow the 13 | [installation instructions](../../install.md) 14 | to get a working setup of CUE. 15 | 16 | Use the `cue eval` or `cue export` commands to evaluate an example. 17 | 18 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_expr.txt: -------------------------------------------------------------------------------- 1 | ! cue eval -c -e b.a.b -e b.idx 2 | cmp stderr expect-stderr 3 | cmp stdout expect-stdout 4 | 5 | -- expect-stdout -- 6 | // b.a.b 7 | 4 8 | -- expect-stderr -- 9 | // b.idx 10 | b.idx: invalid non-ground value string (must be concrete string) 11 | -- partial.cue -- 12 | package partial 13 | 14 | def: *1 | int 15 | sum: 1 | 2 16 | 17 | b: { 18 | idx: a[str] // should resolve to top-level `a` 19 | str: string 20 | } 21 | b: a: b: 4 22 | a: { 23 | b: 3 24 | c: 4 25 | } 26 | c: b & {str: "b"} 27 | 28 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/watch/streamwatcher_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/watch 4 | 5 | package watch 6 | 7 | // Decoder allows StreamWatcher to watch any stream for which a Decoder can be written. 8 | #Decoder: _ 9 | 10 | // Reporter hides the details of how an error is turned into a runtime.Object for 11 | // reporting on a watch stream since this package may not import a higher level report. 12 | #Reporter: _ 13 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/def_force.txt: -------------------------------------------------------------------------------- 1 | # Verify that def with --force works 2 | 3 | # First time should simply succeed 4 | cue def -o test.cue file.cue 5 | cmp test.cue file.cue 6 | 7 | # Second time will fail without --force 8 | ! cue def -o test.cue file.cue 9 | stderr 'error writing "test.cue": file already exists' 10 | 11 | # Second time with --force should succeed 12 | cue def --force -o test.cue file.cue 13 | cmp test.cue file.cue 14 | 15 | -- file.cue -- 16 | package hello 17 | 18 | #who: "World" 19 | message: "Hello \(#who)!" 20 | -------------------------------------------------------------------------------- /cue/testdata/basicrewrite/aliases/aliases.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | t0: { 3 | a=_a: _ 4 | let _b = a 5 | _out: _b 6 | } 7 | t1: { 8 | _a: b 9 | let b = c 10 | c=d: 3 11 | } 12 | -- out/compile -- 13 | --- in.cue 14 | { 15 | t0: { 16 | _a: _ 17 | _out: 〈0;let _b〉 18 | } 19 | t1: { 20 | _a: 〈0;let b〉 21 | d: 3 22 | } 23 | } 24 | -- out/eval -- 25 | (struct){ 26 | t0: (struct){ 27 | _a: (_){ _ } 28 | _out: (_){ _ } 29 | } 30 | t1: (struct){ 31 | _a: (int){ 3 } 32 | d: (int){ 3 } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /encoding/jsonschema/testdata/emptyanyof.txtar: -------------------------------------------------------------------------------- 1 | -- emptyanyof.json -- 2 | { 3 | "$defs": { 4 | "shell": { 5 | "description": "Specify a shell.", 6 | "type": "string", 7 | "anyOf": [ 8 | { 9 | }, 10 | { 11 | "enum": [ 12 | "bash", 13 | "sh", 14 | "cmd", 15 | "powershell" 16 | ] 17 | } 18 | ] 19 | } 20 | } 21 | } 22 | 23 | -- out.cue -- 24 | _ 25 | 26 | #shell: (string | ("bash" | "sh" | "cmd" | "powershell")) & string 27 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/trim_force.txt: -------------------------------------------------------------------------------- 1 | # Verify that trim with --force works 2 | 3 | # First time should simply succeed 4 | cue trim -o test.cue file.cue 5 | cmp test.cue file.cue 6 | 7 | # Second time will fail without --force 8 | ! cue trim -o test.cue file.cue 9 | stderr 'error writing "test.cue": file already exists' 10 | 11 | # Second time with --force should succeed 12 | cue trim --force -o test.cue file.cue 13 | cmp test.cue file.cue 14 | 15 | -- file.cue -- 16 | package hello 17 | 18 | #who: "World" 19 | message: "Hello \(#who)!" 20 | -------------------------------------------------------------------------------- /cue/testdata/export/004.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | { 5 | $type: 3 6 | "_": int 7 | "_foo": int 8 | _bar: int 9 | } 10 | -- out/def -- 11 | $type: 3 12 | "_": int 13 | "_foo": int 14 | _bar: int 15 | -- out/compile -- 16 | --- in.cue 17 | { 18 | { 19 | $type: 3 20 | _: int 21 | "_foo": int 22 | _bar: int 23 | } 24 | } 25 | -- out/eval -- 26 | (struct){ 27 | $type: (int){ 3 } 28 | _: (int){ int } 29 | "_foo": (int){ int } 30 | _bar: (int){ int } 31 | } 32 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/api/resource/math_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/api/resource 4 | 5 | package resource 6 | 7 | // maxInt64Factors is the highest value that will be checked when removing factors of 10 from an int64. 8 | // It is also the maximum decimal digits that can be represented with an int64. 9 | _#maxInt64Factors: 18 10 | 11 | _#mostNegative: -9223372036854775808 12 | 13 | _#mostPositive: 9223372036854775807 14 | -------------------------------------------------------------------------------- /encoding/protobuf/examples/basic/basic.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | // Package basic is just that: basic. 4 | package cuelang.examples.basic; 5 | 6 | import "cue/cue.proto"; 7 | 8 | option go_package = "cuelang.org/encoding/protobuf/examples/basic"; 9 | 10 | // This is my type. 11 | message MyType { 12 | string string_value = 1; // just any 'ole string 13 | 14 | // A method must start with a capital letter. 15 | repeated string method = 2 [(cue.val) = '[...=~"^[A-Z]"]']; 16 | 17 | map example_map = 3; 18 | } 19 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/goproxytest.txt: -------------------------------------------------------------------------------- 1 | # Basic test to ensure that the goproxytest instance used by various testscript 2 | # tests works as expected. 3 | 4 | go get example.com/blah 5 | go mod tidy 6 | cmp go.mod go.mod.golden 7 | 8 | -- go.mod -- 9 | module rubbish 10 | 11 | go 1.14 12 | -- main.go -- 13 | package main 14 | 15 | import ( 16 | "fmt" 17 | 18 | "example.com/blah" 19 | ) 20 | 21 | func main() { 22 | fmt.Println(blah.Orange) 23 | } 24 | -- go.mod.golden -- 25 | module rubbish 26 | 27 | go 1.14 28 | 29 | require example.com/blah v1.0.0 30 | -------------------------------------------------------------------------------- /cue/testdata/packages/sub.txtar: -------------------------------------------------------------------------------- 1 | cue eval ./pkg:foo 2 | 3 | -- cue.mod/module.cue -- 4 | module: "example.com" 5 | 6 | -- in.cue -- 7 | package test 8 | 9 | import pkg2 "example.com/foo/pkg1" 10 | #pkg1: pkg2.Object 11 | 12 | "Hello \(#pkg1)!" 13 | 14 | -- foo/pkg1/file.cue -- 15 | package pkg1 16 | 17 | Object: "World" 18 | 19 | -- out/eval -- 20 | (string){ 21 | "Hello World!" 22 | #pkg1: (string){ "World" } 23 | } 24 | -- out/compile -- 25 | --- in.cue 26 | { 27 | #pkg1: 〈import;"example.com/foo/pkg1"〉.Object 28 | "Hello \(〈0;#pkg1〉)!" 29 | } 30 | -------------------------------------------------------------------------------- /encoding/jsonschema/testdata/refroot2.txtar: -------------------------------------------------------------------------------- 1 | // This test tests the conversion and ordering of $defs. 2 | 3 | -- definition.json -- 4 | { 5 | "$schema": "http://json-schema.org/draft-07/schema#", 6 | 7 | "properties": { 8 | "value": {}, 9 | "next": { "$ref": "#" } 10 | } 11 | } 12 | 13 | -- out.cue -- 14 | _schema 15 | _schema: { 16 | @jsonschema(schema="http://json-schema.org/draft-07/schema#") 17 | null | bool | number | string | [...] | { 18 | value?: _ 19 | next?: _schema_1 20 | ... 21 | } 22 | } 23 | 24 | let _schema_1 = _schema 25 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_rec.txt: -------------------------------------------------------------------------------- 1 | cue eval ./rec.cue -O 2 | cmp stdout expect-stdout 3 | -- rec.cue -- 4 | Foo: { 5 | foo?: Foo 6 | bar: string 7 | baz: bar + "2" 8 | } 9 | 10 | foo: Foo & { 11 | foo: { 12 | bar: "barNested" 13 | } 14 | bar: "barParent" 15 | } 16 | -- expect-stdout -- 17 | Foo: { 18 | foo?: Foo 19 | bar: string 20 | baz: bar + "2" 21 | } 22 | foo: { 23 | foo: { 24 | foo?: Foo 25 | bar: "barNested" 26 | baz: "barNested2" 27 | } 28 | bar: "barParent" 29 | baz: "barParent2" 30 | } 31 | -------------------------------------------------------------------------------- /cue/testdata/compile/files.txtar: -------------------------------------------------------------------------------- 1 | // Issue #946 2 | -- in.cue -- 3 | package repro 4 | 5 | a: [] 6 | 7 | -- out.cue -- 8 | package repro 9 | 10 | x: {for a in a {}} 11 | y: {{{for a in a {}}}} 12 | -- out/compile -- 13 | --- in.cue 14 | { 15 | a: [] 16 | } 17 | --- out.cue 18 | { 19 | x: { 20 | for _, a in 〈1;a〉 {} 21 | } 22 | y: { 23 | { 24 | { 25 | for _, a in 〈3;a〉 {} 26 | } 27 | } 28 | } 29 | } 30 | -- out/eval -- 31 | (struct){ 32 | a: (#list){ 33 | } 34 | x: (struct){ 35 | } 36 | y: (struct){ 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /cue/testdata/export/issue854.txtar: -------------------------------------------------------------------------------- 1 | -- cue.mod/module.cue -- 2 | module: "mod.com" 3 | -- a.cue -- 4 | package a 5 | 6 | import "mod.com/b" 7 | 8 | theb: b.name 9 | -- b/b.cue -- 10 | package b 11 | 12 | import "mod.com/c" 13 | 14 | b: c.c & { 15 | other: "name" 16 | } 17 | 18 | name: b.other 19 | -- c/c.cue -- 20 | package c 21 | -- out/compile -- 22 | --- a.cue 23 | { 24 | theb: 〈import;"mod.com/b"〉.name 25 | } 26 | -- out/eval -- 27 | (struct){ 28 | theb: (_|_){ 29 | // [incomplete] b: undefined field: c: 30 | // ./b/b.cue:5:6 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tools/trim/testdata/rmimport.txtar: -------------------------------------------------------------------------------- 1 | // Issue #716 2 | // 3 | // NOTE removing the empty import decl is more a job for 4 | // cue/format or astutil.Sanitize. 5 | 6 | -- a/a.cue -- 7 | package a 8 | 9 | A: 5 10 | -- b.cue -- 11 | package b 12 | 13 | import ( 14 | "example.com/blah/a" 15 | ) 16 | 17 | #Def: { 18 | y: 5 19 | } 20 | 21 | x: #Def 22 | x: y: a.A 23 | -- cue.mod/module.cue -- 24 | module: "example.com/blah" 25 | 26 | -- out/trim -- 27 | == b.cue 28 | package b 29 | 30 | import ( 31 | ) 32 | 33 | #Def: { 34 | y: 5 35 | } 36 | 37 | x: #Def 38 | x: {} 39 | -------------------------------------------------------------------------------- /cue/testdata/export/015.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | eval: true 5 | -- in.cue -- 6 | { 7 | a: (*1 | 2) & (1 | *2) 8 | b: [(*1 | 2) & (1 | *2)] 9 | } 10 | -- out/def -- 11 | a: 1 | 2 | *_|_ 12 | b: [1 | 2 | *_|_] 13 | -- out/compile -- 14 | --- in.cue 15 | { 16 | { 17 | a: ((*1|2) & (1|*2)) 18 | b: [ 19 | ((*1|2) & (1|*2)), 20 | ] 21 | } 22 | } 23 | -- out/eval -- 24 | (struct){ 25 | a: (int){ |((int){ 1 }, (int){ 2 }) } 26 | b: (#list){ 27 | 0: (int){ |((int){ 1 }, (int){ 2 }) } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cue/testdata/export/019.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | -- in.cue -- 5 | {a: >=0 & <=10, b: "Count: \(a) times"} 6 | -- out/def -- 7 | a: >=0 & <=10 8 | b: "Count: \(a) times" 9 | -- out/compile -- 10 | --- in.cue 11 | { 12 | { 13 | a: (>=0 & <=10) 14 | b: "Count: \(〈0;a〉) times" 15 | } 16 | } 17 | -- out/eval -- 18 | (struct){ 19 | a: (number){ &(>=0, <=10) } 20 | b: (_|_){ 21 | // [incomplete] b: invalid interpolation: non-concrete value >=0 & <=10 (type number): 22 | // ./in.cue:1:20 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/apis/meta/v1/time_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/apis/meta/v1 4 | 5 | package v1 6 | 7 | // Time is a wrapper around time.Time which supports correct 8 | // marshaling to YAML and JSON. Wrappers are provided for many 9 | // of the factory methods that the time package offers. 10 | // 11 | // +protobuf.options.marshal=false 12 | // +protobuf.as=Timestamp 13 | // +protobuf.options.(gogoproto.goproto_stringer)=false 14 | #Time: _ 15 | -------------------------------------------------------------------------------- /internal/core/export/testdata/scalardef.txtar: -------------------------------------------------------------------------------- 1 | cue eval ./pkg:foo 2 | 3 | -- cue.mod/module.cue -- 4 | module: "example.com" 5 | 6 | -- in.cue -- 7 | package test 8 | 9 | import pkg2 "example.com/foo/pkg1" 10 | #pkg1: pkg2.Object 11 | 12 | "Hello \(#pkg1)!" 13 | 14 | -- foo/pkg1/file.cue -- 15 | package pkg1 16 | 17 | Object: "World" 18 | 19 | -- out/eval -- 20 | (string){ "Hello World!" } 21 | -- out/doc -- 22 | [] 23 | [#pkg1] 24 | -- out/definition -- 25 | package test 26 | 27 | import pkg2 "example.com/foo/pkg1" 28 | 29 | "Hello \(#pkg1)!" 30 | #pkg1: pkg2.Object 31 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue520.txt: -------------------------------------------------------------------------------- 1 | cue cmd -t greeting=hello prefix 2 | 3 | -- cue.mod/module.cue -- 4 | module: "mod.com" 5 | -- my.cue -- 6 | package tools 7 | 8 | msg: string @tag(greeting) 9 | 10 | -- my_tool.cue -- 11 | package tools 12 | 13 | import ( 14 | "tool/cli" 15 | ) 16 | 17 | greeting: string @tag(greeting) 18 | 19 | command: prefix: { 20 | p1: cli.Print & { 21 | text: greeting 22 | } 23 | salutation: string @tag(greeting) 24 | p2: cli.Print & { 25 | text: salutation 26 | } 27 | p3: cli.Print & { 28 | text: msg @tag(greeting) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cue/testdata/definitions/issue496.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | #A : _ 3 | 4 | #N: #A & { 5 | _E: { 6 | name: "hello" 7 | } 8 | } 9 | 10 | l: #N 11 | 12 | -- out/eval -- 13 | (struct){ 14 | #A: (_){ _ } 15 | #N: (#struct){ 16 | _E: (#struct){ 17 | name: (string){ "hello" } 18 | } 19 | } 20 | l: (#struct){ 21 | _E: (#struct){ 22 | name: (string){ "hello" } 23 | } 24 | } 25 | } 26 | -- out/compile -- 27 | --- in.cue 28 | { 29 | #A: _ 30 | #N: (〈0;#A〉 & { 31 | _E: { 32 | name: "hello" 33 | } 34 | }) 35 | l: 〈0;#N〉 36 | } 37 | -------------------------------------------------------------------------------- /internal/core/export/testdata/def.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: int | *2 3 | b?: 4 | 5 4 | c: [string]: int 5 | -- out/definition -- 6 | a: int | *2 7 | b?: 4 | 5 8 | c: { 9 | [string]: int 10 | } 11 | -- out/doc -- 12 | [] 13 | [a] 14 | [c] 15 | -- out/value -- 16 | == Simplified 17 | { 18 | a: *2 | int 19 | c: {} 20 | } 21 | == Raw 22 | { 23 | a: *2 | int 24 | b?: 4 | 5 25 | c: {} 26 | } 27 | == Final 28 | { 29 | a: 2 30 | c: {} 31 | } 32 | == All 33 | { 34 | a: *2 | int 35 | b?: 4 | 5 36 | c: {} 37 | } 38 | == Eval 39 | { 40 | a: 2 41 | b?: 4 | 5 42 | c: {} 43 | } 44 | -------------------------------------------------------------------------------- /cue/testdata/export/003.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | "hello\nworld" 5 | -- out/def -- 6 | """ 7 | hello 8 | world 9 | """ 10 | -- out/export -- 11 | """ 12 | hello 13 | world 14 | """ 15 | -- out/yaml -- 16 | |- 17 | hello 18 | world 19 | -- out/json -- 20 | "hello\nworld" 21 | -- out/legacy-debug -- 22 | """ 23 | hello 24 | world 25 | """ 26 | -- out/compile -- 27 | --- in.cue 28 | { 29 | "hello\nworld" 30 | } 31 | -- out/eval -- 32 | (string){ "hello\nworld" } 33 | -------------------------------------------------------------------------------- /cue/testdata/export/002.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | 'hello\nworld' 5 | -- out/def -- 6 | ''' 7 | hello 8 | world 9 | ''' 10 | -- out/export -- 11 | ''' 12 | hello 13 | world 14 | ''' 15 | -- out/yaml -- 16 | |- 17 | hello 18 | world 19 | -- out/json -- 20 | "aGVsbG8Kd29ybGQ=" 21 | -- out/legacy-debug -- 22 | ''' 23 | hello 24 | world 25 | ''' 26 | -- out/compile -- 27 | --- in.cue 28 | { 29 | 'hello\nworld' 30 | } 31 | -- out/eval -- 32 | (bytes){ 'hello\nworld' } 33 | -------------------------------------------------------------------------------- /cue/testdata/export/005.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | {a: 1, b: a + 2, c: null, d: true, e: _, f: string} 5 | -- out/def -- 6 | a: 1 7 | b: 3 8 | c: null 9 | d: true 10 | e: _ 11 | f: string 12 | -- out/compile -- 13 | --- in.cue 14 | { 15 | { 16 | a: 1 17 | b: (〈0;a〉 + 2) 18 | c: null 19 | d: true 20 | e: _ 21 | f: string 22 | } 23 | } 24 | -- out/eval -- 25 | (struct){ 26 | a: (int){ 1 } 27 | b: (int){ 3 } 28 | c: (null){ null } 29 | d: (bool){ true } 30 | e: (_){ _ } 31 | f: (string){ string } 32 | } 33 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/services/kitchen/caller/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: caller: _kitchenDeployment & { 4 | replicas: 3 5 | image: "gcr.io/myproj/caller:v0.20.14" 6 | 7 | arg: key: "/etc/certs/client.key" 8 | arg: cert: "/etc/certs/client.pem" 9 | arg: ca: "/etc/certs/servfx.ca" 10 | 11 | arg: "ssh-tunnel-key": "/sslcerts/tunnel-private.pem" 12 | 13 | volume: "caller-disk": { 14 | name: "ssd-caller" 15 | } 16 | 17 | volume: "secret-ssh-key": { 18 | mountPath: "/sslcerts" 19 | readOnly: true 20 | spec: secret: secretName: "secrets" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/math/testdata/issue418.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | import "math" 3 | 4 | a: { 5 | x: 32.45 6 | y: int 7 | y: math.Round(x) 8 | } 9 | 10 | b: { 11 | x: 32.45 12 | y: int 13 | y: math.Log(x) 14 | } 15 | -- out/math -- 16 | Errors: 17 | b.y: conflicting values int and 3.47970044315009900124277 (mismatched types int and float): 18 | ./in.cue:11:8 19 | ./in.cue:12:8 20 | 21 | Result: 22 | a: { 23 | x: 32.45 24 | y: 32 25 | } 26 | b: { 27 | x: 32.45 28 | y: _|_ // b.y: conflicting values int and 3.47970044315009900124277 (mismatched types int and float) 29 | } 30 | 31 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/get_go_unresolvable_package.txt: -------------------------------------------------------------------------------- 1 | # Test that we get expected error when we ask cue get go to get 2 | # a Go package that cannot be resolved. 3 | 4 | # Ensure that we don't automatically add the missing dependency pre Go 1.16 5 | [!go1.16] env GOFLAGS=-mod=readonly 6 | 7 | ! cue get go k8s.io/api/apps/v1 8 | [go1.16] stderr '\Qno required module provides package k8s.io/api/apps/v1' 9 | [go1.14] [!go1.16] stderr '\Qcannot find module providing package k8s.io/api/apps/v1: import lookup disabled by -mod=readonly' 10 | 11 | -- go.mod -- 12 | module mod.com/blah 13 | 14 | go 1.14 15 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/import_binary.txt: -------------------------------------------------------------------------------- 1 | cue import binary --ext crt . 2 | cmp x.cue out/expect.cue 3 | 4 | cue export bin.cue --out binary 5 | cmp stdout out/bin 6 | 7 | # TODO: txtarscript should distinguish final newline 8 | cue export str.cue --out binary 9 | cmp stdout out/str 10 | 11 | -- x.crt -- 12 | 1234 13 | -- y.crt2 -- 14 | // Skip this file, wrong extension. 15 | -- bin.cue -- 16 | ''' 17 | foo 18 | 19 | ''' 20 | -- str.cue -- 21 | """ 22 | foo 23 | 24 | """ 25 | -- out/bin -- 26 | foo 27 | -- out/str -- 28 | foo 29 | -- out/expect.cue -- 30 | ''' 31 | 1234 32 | 33 | ''' 34 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/proxy/goget/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: goget: spec: { 4 | // podTemplate defines the 'cookie cutter' used for creating 5 | // new pods when necessary 6 | template: { 7 | spec: { 8 | volumes: [{ 9 | name: "secret-volume" 10 | secret: secretName: "goget-secrets" 11 | }] 12 | containers: [{ 13 | image: "gcr.io/myproj/goget:v0.5.1" 14 | ports: [{ 15 | containerPort: 7443 16 | }] 17 | volumeMounts: [{ 18 | mountPath: "/etc/ssl" 19 | name: "secret-volume" 20 | }] 21 | }] 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /internal/core/dep/testdata/dynamic.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | first: { 3 | out: [1, 2] 4 | } 5 | ignore: { 6 | x: 1 7 | y: a.c 8 | } 9 | middle: { 10 | for x in first.out { 11 | ignore.y 12 | 13 | "la\(x)": ignore & { 14 | seq: x+1 15 | val: "foo\(x)" 16 | out: ignore.x 17 | } 18 | } 19 | } 20 | 21 | a: { 22 | b: [ for x in middle { x } ] 23 | c: {} 24 | } 25 | -- out/dependencies/field -- 26 | middle 27 | -- out/dependencies/all -- 28 | middle 29 | -- out/dependencies/dynamic -- 30 | middle 31 | middle.la1 32 | middle.la2 33 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/export_force.txt: -------------------------------------------------------------------------------- 1 | # Verify that export with --force works 2 | 3 | # First time should simply succeed 4 | cue export -o test.yml file.cue 5 | cmp test.yml test.yml.golden 6 | 7 | # Second time will fail without --force 8 | ! cue export -o test.yml file.cue 9 | stderr 'error writing "test.yml": file already exists' 10 | 11 | # Second time with --force should succeed 12 | cue export --force -o test.yml file.cue 13 | cmp test.yml test.yml.golden 14 | 15 | -- file.cue -- 16 | package hello 17 | 18 | #who: "World" 19 | message: "Hello \(#who)!" 20 | -- test.yml.golden -- 21 | message: Hello World! 22 | -------------------------------------------------------------------------------- /doc/tutorial/basics/6_expressions/20_interpolation.txt: -------------------------------------------------------------------------------- 1 | cue eval interpolation.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Interpolation" 6 | description = "" 7 | 8 | -- text.md -- 9 | String and bytes literals support interpolation. 10 | 11 | Any valid CUE expression may be used inside the escaped parentheses. 12 | Interpolation may also be used in multiline string and byte literals. 13 | 14 | -- interpolation.cue -- 15 | "You are \( #cost - #budget ) dollars over budget!" 16 | 17 | #cost: 102 18 | #budget: 88 19 | 20 | -- expect-stdout-cue -- 21 | "You are 14 dollars over budget!" 22 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_run_list.txt: -------------------------------------------------------------------------------- 1 | cue cmd run_list 2 | stdout 'Hello world!' 3 | 4 | -- task.cue -- 5 | package home 6 | message: "Hello world!" 7 | 8 | -- task_tool.cue -- 9 | package home 10 | 11 | command: run_list: runBase & { 12 | task: echo: cmd: ["echo", message] 13 | } 14 | 15 | -- base_tool.cue -- 16 | package home 17 | 18 | // deliberately put in another file to test resolving top-level identifiers 19 | // in different files. 20 | runBase: { 21 | task: echo: { 22 | kind: "exec" 23 | stdout: string 24 | } 25 | 26 | task: display: { 27 | kind: "print" 28 | text: task.echo.stdout 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_force.txt: -------------------------------------------------------------------------------- 1 | # Verify that eval with --force works 2 | 3 | # First time should simply succeed 4 | cue eval -o eval.cue file.cue 5 | cmp eval.cue eval.golden 6 | 7 | # Second time will fail without --force 8 | ! cue eval -o eval.cue file.cue 9 | stderr 'error writing "eval.cue": file already exists' 10 | 11 | # Second time with --force should succeed 12 | cue eval --force -o eval.cue file.cue 13 | cmp eval.cue eval.golden 14 | 15 | -- file.cue -- 16 | package hello 17 | 18 | #who: "World" 19 | message: "Hello \(#who)!" 20 | -- eval.golden -- 21 | #who: "World" 22 | message: "Hello World!" 23 | -------------------------------------------------------------------------------- /doc/tutorial/basics/4_references/20_selectors.txt: -------------------------------------------------------------------------------- 1 | cue eval selectors.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Accessing Fields" 6 | description = "" 7 | 8 | -- text.md -- 9 | Selectors access fields within a struct using the `.` notation. 10 | This only works if a field name is a valid identifier and it is not computed. 11 | For other cases one can use the indexing notation. 12 | 13 | -- selectors.cue -- 14 | a: { 15 | b: 2 16 | "c-e": 5 17 | } 18 | v: a.b 19 | w: a["c-e"] 20 | 21 | -- expect-stdout-cue -- 22 | a: { 23 | b: 2 24 | "c-e": 5 25 | } 26 | v: 2 27 | w: 5 28 | -------------------------------------------------------------------------------- /internal/third_party/yaml/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 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 | -------------------------------------------------------------------------------- /cue/testdata/export/012.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | -- in.cue -- 5 | {a: *"foo" | *"bar" | *string | int, b: a[2:3]} 6 | -- out/def -- 7 | a: *string | int 8 | b: _|_ // cannot slice a (type string) 9 | -- out/compile -- 10 | --- in.cue 11 | { 12 | { 13 | a: (*"foo"|*"bar"|*string|int) 14 | b: 〈0;a〉[2:3] 15 | } 16 | } 17 | -- out/eval -- 18 | (struct){ 19 | a: ((int|string)){ |(*(string){ "foo" }, *(string){ "bar" }, *(string){ string }, (int){ int }) } 20 | b: (_|_){ 21 | // [incomplete] b: non-concrete slice subject a: 22 | // ./in.cue:1:41 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/hidden.txt: -------------------------------------------------------------------------------- 1 | cue eval pkg.cue -H 2 | cmp stdout expect-stdout 3 | 4 | cue eval -H 5 | cmp stdout expect-stdout 6 | 7 | cue eval file.cue -H 8 | cmp stdout expect-stdout 9 | 10 | -- pkg.cue -- 11 | package pkg 12 | 13 | _top: 1 14 | 15 | a: _h0: int 16 | 17 | #foo: { 18 | _h1: string 19 | } 20 | 21 | { 22 | _h2: string 23 | } 24 | 25 | -- file.cue -- 26 | _top: 1 27 | 28 | a: _h0: int 29 | 30 | #foo: { 31 | _h1: string 32 | } 33 | 34 | { 35 | _h2: string 36 | } 37 | 38 | -- expect-stdout -- 39 | _top: 1 40 | a: { 41 | _h0: int 42 | } 43 | _h2: string 44 | #foo: { 45 | _h1: string 46 | } 47 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/import_files.txt: -------------------------------------------------------------------------------- 1 | cue import -o - -f --files ./import 2 | cmp stdout expect-stdout 3 | -- expect-stdout -- 4 | kind: "Service" 5 | name: "booster" 6 | kind: "Deployment" 7 | name: "booster" 8 | replicas: 1 9 | kind: "Service" 10 | name: """ 11 | supplement 12 | foo 13 | """ 14 | json: "[1, 2]" 15 | -- import/services.jsonl -- 16 | { 17 | "kind": "Service", 18 | "name": "booster" 19 | } 20 | { 21 | "kind": "Deployment", 22 | "name": "booster", 23 | "replicas": 1 24 | } 25 | { 26 | "kind": "Service", 27 | "name": "supplement\nfoo", 28 | "json": "[1, 2]" 29 | } 30 | -- cue.mod -- 31 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kitchen/linecook/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: linecook: spec: template: spec: { 4 | volumes: [{ 5 | }, { 6 | name: "secret-kitchen" 7 | secret: secretName: "secrets" 8 | }] 9 | containers: [{ 10 | image: "gcr.io/myproj/linecook:v0.1.42" 11 | volumeMounts: [{ 12 | }, { 13 | name: "secret-kitchen" 14 | }] 15 | args: [ 16 | "-name=linecook", 17 | "-env=prod", 18 | "-logdir=/logs", 19 | "-event-server=events:7788", 20 | "-etcd", 21 | "etcd:2379", 22 | "-reconnect-delay", 23 | "1h", 24 | "-recovery-overlap", 25 | "100000", 26 | ] 27 | }] 28 | } 29 | -------------------------------------------------------------------------------- /cue/testdata/export/027.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | 4 | TODO: Should #Bar result in string or #Foo | string? 5 | 6 | 7 | raw: true 8 | eval: true 9 | -- in.cue -- 10 | { 11 | #Foo: { 12 | #Bar: #Foo | string 13 | } 14 | } 15 | -- out/def -- 16 | #Foo: { 17 | #Bar: #Foo | string 18 | } 19 | -- out/export -- 20 | 21 | -- out/yaml -- 22 | {} 23 | -- out/json -- 24 | {} 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | { 29 | #Foo: { 30 | #Bar: (〈1;#Foo〉|string) 31 | } 32 | } 33 | } 34 | -- out/eval -- 35 | (struct){ 36 | #Foo: (#struct){ 37 | #Bar: (string){ string } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /doc/tutorial/basics/4_references/50_emit.txt: -------------------------------------------------------------------------------- 1 | cue eval emit.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Emit Values" 6 | description = "" 7 | 8 | -- text.md -- 9 | By default all top-level fields are emitted when evaluating a configuration. 10 | Embedding a value at top-level will cause that value to be emitted instead. 11 | 12 | Emit values allow CUE configurations, like JSON, 13 | to define any type, instead of just structs, while keeping the common case 14 | of defining structs light. 15 | 16 | -- emit.cue -- 17 | "Hello \(#who)!" 18 | 19 | #who: "world" 20 | 21 | -- expect-stdout-cue -- 22 | "Hello world!" 23 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kitchen/pastrychef/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: pastrychef: spec: template: spec: { 4 | volumes: [{ 5 | }, { 6 | name: "secret-ssh-key" 7 | secret: secretName: "secrets" 8 | }] 9 | containers: [{ 10 | image: "gcr.io/myproj/pastrychef:v0.1.15" 11 | volumeMounts: [{ 12 | }, { 13 | name: "secret-ssh-key" 14 | }] 15 | args: [ 16 | "-env=prod", 17 | "-ssh-tunnel-key=/etc/certs/tunnel-private.pem", 18 | "-logdir=/logs", 19 | "-event-server=events:7788", 20 | "-reconnect-delay=1m", 21 | "-etcd=etcd:2379", 22 | "-recovery-overlap=10000", 23 | ] 24 | }] 25 | } 26 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_dep.txt: -------------------------------------------------------------------------------- 1 | cue cmd do 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | {"b":"cue"} 6 | -- task_tool.cue -- 7 | package home 8 | 9 | import ( 10 | "encoding/json" 11 | "strings" 12 | "tool/cli" 13 | "tool/exec" 14 | ) 15 | 16 | foo: { 17 | #a: string 18 | b: #a 19 | } 20 | 21 | command: do: { 22 | inputs: name: exec.Run & { 23 | cmd: "echo cue" 24 | stdout: string 25 | } 26 | outputs: print: cli.Print & { 27 | text: json.Marshal(foo & { 28 | #a: strings.TrimSpace(inputs.name.stdout) 29 | }) 30 | } 31 | } 32 | 33 | -- cue.mod -- 34 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_err.txt: -------------------------------------------------------------------------------- 1 | ! cue cmd ref 2 | ! stdout . 3 | cmp stderr cmd_badfields.out 4 | 5 | -- cmd_badfields.out -- 6 | command.ref.task.display.contents: invalid bytes argument: non-concrete value (string|bytes): 7 | ./task_tool.cue:6:8 8 | tool/file:17:3 9 | command.ref.task.display.filename: invalid string argument: non-concrete value string: 10 | ./task_tool.cue:6:8 11 | ./task_tool.cue:7:9 12 | tool/file:15:3 13 | tool/file:15:16 14 | -- task_tool.cue -- 15 | package home 16 | 17 | import "tool/file" 18 | 19 | command: ref: { 20 | task: display: file.Create & { 21 | filename: filename 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_run.txt: -------------------------------------------------------------------------------- 1 | cue cmd run 2 | stdout 'Hello world!' 3 | 4 | -- task.cue -- 5 | package home 6 | message: "Hello world!" 7 | 8 | -- task_tool.cue -- 9 | package home 10 | 11 | command: run: #RunBase & { 12 | task: echo: cmd: "echo \(message)" 13 | } 14 | 15 | -- base_tool.cue -- 16 | package home 17 | 18 | import ( 19 | "tool/cli" 20 | "tool/exec" 21 | ) 22 | 23 | // deliberately put in another file to test resolving top-level identifiers 24 | // in different files. 25 | #RunBase: { 26 | task: echo: exec.Run & { 27 | stdout: string 28 | } 29 | 30 | task: display: cli.Print & { 31 | text: task.echo.stdout 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cue/testdata/export/031.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | eval: true 5 | -- in.cue -- 6 | { 7 | A: [uint] 8 | B: A & ([10] | [192]) 9 | } 10 | -- out/def -- 11 | A: [>=0] 12 | B: A & ([10] | [192]) 13 | -- out/compile -- 14 | --- in.cue 15 | { 16 | { 17 | A: [ 18 | &(int, >=0), 19 | ] 20 | B: (〈0;A〉 & ([ 21 | 10, 22 | ]|[ 23 | 192, 24 | ])) 25 | } 26 | } 27 | -- out/eval -- 28 | (struct){ 29 | A: (#list){ 30 | 0: (int){ &(>=0, int) } 31 | } 32 | B: (list){ |((#list){ 33 | 0: (int){ 10 } 34 | }, (#list){ 35 | 0: (int){ 192 } 36 | }) } 37 | } 38 | -------------------------------------------------------------------------------- /cue/testdata/fulleval/054_issue312.txtar: -------------------------------------------------------------------------------- 1 | #name: issue312 2 | #evalFull 3 | -- in.cue -- 4 | y: *1 | {a: 2} 5 | for x in [1] {y} 6 | -- out/def -- 7 | y: *1 | { 8 | a: 2 9 | } 10 | a: 2 11 | -- out/export -- 12 | y: 1 13 | a: 2 14 | -- out/yaml -- 15 | y: 1 16 | a: 2 17 | -- out/json -- 18 | {"y":1,"a":2} 19 | -- out/legacy-debug -- 20 | <0>{y: 1, a: 2} 21 | -- out/compile -- 22 | --- in.cue 23 | { 24 | y: (*1|{ 25 | a: 2 26 | }) 27 | for _, x in [ 28 | 1, 29 | ] { 30 | 〈2;y〉 31 | } 32 | } 33 | -- out/eval -- 34 | (struct){ 35 | y: ((int|struct)){ |(*(int){ 1 }, (struct){ 36 | a: (int){ 2 } 37 | }) } 38 | a: (int){ 2 } 39 | } 40 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/builtins.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "time" 3 | "list" 4 | ) 5 | 6 | let _time = time 7 | 8 | #MyStruct: { 9 | timestamp1?: time.Time 10 | timestamp2?: time.Time() 11 | timestamp3?: time.Format(time.RFC3339Nano) 12 | timestamp4?: _time.Time 13 | date1?: time.Format(time.RFC3339Date) 14 | date2?: _time.Format(time.RFC3339Date) 15 | 16 | // This is not an OpenAPI type and has no format. In this case 17 | // we map to a type so that it can be documented properly (without 18 | // repeating it). 19 | timeout?: time.Duration 20 | 21 | contains: list.Contains("foo") // not supported, but should be recognized as list 22 | } 23 | -------------------------------------------------------------------------------- /cue/testdata/definitions/issue497.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | #A : _ 3 | 4 | #N: #A & { 5 | f: j: { 6 | n: "hi" 7 | } 8 | } 9 | 10 | l: #N 11 | 12 | -- out/eval -- 13 | (struct){ 14 | #A: (_){ _ } 15 | #N: (#struct){ 16 | f: (#struct){ 17 | j: (#struct){ 18 | n: (string){ "hi" } 19 | } 20 | } 21 | } 22 | l: (#struct){ 23 | f: (#struct){ 24 | j: (#struct){ 25 | n: (string){ "hi" } 26 | } 27 | } 28 | } 29 | } 30 | -- out/compile -- 31 | --- in.cue 32 | { 33 | #A: _ 34 | #N: (〈0;#A〉 & { 35 | f: { 36 | j: { 37 | n: "hi" 38 | } 39 | } 40 | }) 41 | l: 〈0;#N〉 42 | } 43 | -------------------------------------------------------------------------------- /doc/tutorial/basics/6_expressions/25_interpolfield.txt: -------------------------------------------------------------------------------- 1 | ! cue eval genfield.cue 2 | cmp stderr expect-stderr 3 | 4 | -- frontmatter.toml -- 5 | title = "Interpolation of Field Names" 6 | description = "" 7 | 8 | -- text.md -- 9 | String interpolations may also be used in field names. 10 | 11 | One cannot refer to generated fields with references. 12 | 13 | -- genfield.cue -- 14 | sandwich: { 15 | type: "Cheese" 16 | "has\(type)": true 17 | hasButter: true 18 | butterAndCheese: hasButter && hasCheese 19 | } 20 | 21 | -- expect-stderr -- 22 | sandwich.butterAndCheese: reference "hasCheese" not found: 23 | ./genfield.cue:5:35 24 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/file_forms.txt: -------------------------------------------------------------------------------- 1 | cue eval data: foo.cue 2 | cmp stdout expect-data-foo 3 | 4 | ! cue eval data: bar.cue 5 | cmp stderr expect-data-bar 6 | 7 | cue eval graph: bar.cue 8 | cmp stdout expect-graph-bar 9 | 10 | -- foo.cue -- 11 | a: 4 12 | b: { 13 | c: 1 14 | } 15 | // Duplicates are still allowed. 16 | b: { 17 | d: 2 18 | } 19 | 20 | -- bar.cue -- 21 | a: 4 22 | b: { 23 | c: a 24 | } 25 | 26 | -- expect-data-foo -- 27 | a: 4 28 | b: { 29 | c: 1 30 | d: 2 31 | } 32 | -- expect-data-bar -- 33 | references not allowed in data mode: 34 | ./bar.cue:3:8 35 | -- expect-graph-bar -- 36 | a: 4 37 | b: { 38 | c: 4 39 | } 40 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/install.txt: -------------------------------------------------------------------------------- 1 | # Test that we can install CUE via the pre Go 1.16 install 2 | # method (which should also work with Go 1.16) described in 3 | # the project README 4 | # 5 | # Keep this test in sync with all places that describe install 6 | # instructions 7 | 8 | [!long] skip 'Install tests use the network and take some time' 9 | 10 | # For this test we want to use the real proxy 11 | env GOPROXY=https://proxy.golang.org 12 | 13 | # Sanity check pre install 14 | ! exists $WORK/gopath/bin/cue 15 | 16 | # Install 17 | env GO111MODULE=on 18 | go get cuelang.org/go/cmd/cue 19 | exec $WORK/gopath/bin/cue help 20 | stdout 'cue evaluates CUE files' 21 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/install_go1.16.txt: -------------------------------------------------------------------------------- 1 | # Test that we can install CUE via the new Go 1.16 go install 2 | # method described in the project README 3 | # 4 | # Keep this test in sync with all places that describe install 5 | # instructions 6 | 7 | [!go1.16] skip 'Test only applies to Go 1.16' 8 | [!long] skip 'Install tests use the network and take some time' 9 | 10 | # For this test we want to use the real proxy 11 | env GOPROXY=https://proxy.golang.org 12 | 13 | # Sanity check pre install 14 | ! exists $WORK/gopath/bin/cue 15 | 16 | # Install 17 | go install cuelang.org/go/cmd/cue@latest 18 | exec $WORK/gopath/bin/cue help 19 | stdout 'cue evaluates CUE files' 20 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue986.txt: -------------------------------------------------------------------------------- 1 | 2 | # Hidden values are dropped when outputting CUE. This is fine in eval for 3 | # debugging, but not when the final result needs to be compiled again to be 4 | # converted to another format. 5 | 6 | cue eval in.cue --out yaml 7 | cmp stdout expect-stdout 8 | 9 | -- in.cue -- 10 | #Foo: { 11 | a: string 12 | b: string 13 | ab: "\(a)\(b)" 14 | } 15 | 16 | { 17 | a: "aaa" 18 | b: "bbb" 19 | } & #Foo 20 | 21 | #Bar: { 22 | _c: string 23 | _d: string 24 | cd: "\(_c)\(_d)" 25 | } 26 | 27 | { 28 | _c: "ccc" 29 | _d: "ddd" 30 | } & #Bar 31 | 32 | -- expect-stdout -- 33 | a: aaa 34 | b: bbb 35 | ab: aaabbb 36 | cd: cccddd 37 | -------------------------------------------------------------------------------- /doc/tutorial/basics/0_intro/80_boilerplate.txt: -------------------------------------------------------------------------------- 1 | 2 | -- frontmatter.toml -- 3 | title = "Boilerplate" 4 | description = "" 5 | draft = true 6 | 7 | -- text.md -- 8 | Constraints specify what values are allowed. 9 | To CUE they are just values like anything else, 10 | but conceptually they can be explained as something in between types and 11 | concrete values. 12 | 13 | Constraints can be used to validate values of concrete instances. 14 | They can be applied to CUE data, or directly to YAML or JSON. 15 | 16 | But constraints can also reduce boilerplate. 17 | If a constraints defines a concrete value, there is no need 18 | to specify it in values to which this constraint applies. -------------------------------------------------------------------------------- /tools/trim/testdata/optional.txtar: -------------------------------------------------------------------------------- 1 | // Optional fields should retain status after removal of unified 2 | // content. 3 | 4 | // Issue #855 5 | 6 | -- cue.mod/module.cue -- 7 | module: "mod.com" 8 | -- a.cue -- 9 | package pkg 10 | 11 | a: [...#A] 12 | 13 | a: [{ 14 | annotations: {} 15 | }] 16 | 17 | #A: annotations?: [string]: string 18 | 19 | b: #B 20 | b: bb: c: 2 // c can be removed, bb not. 21 | #B: bb?: c: 2 22 | 23 | -- out/trim -- 24 | == a.cue 25 | package pkg 26 | 27 | a: [...#A] 28 | 29 | a: [{ 30 | annotations: {} 31 | }] 32 | 33 | #A: annotations?: [string]: string 34 | 35 | b: #B 36 | b: bb: {} // c can be removed, bb not. 37 | #B: bb?: c: 2 38 | -------------------------------------------------------------------------------- /cue/testdata/definitions/list.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | c: #R & { 3 | w: [{}, {b: int}] 4 | } 5 | #R: { 6 | w: [{}, ...] 7 | } 8 | -- out/eval -- 9 | (struct){ 10 | c: (#struct){ 11 | w: (#list){ 12 | 0: (#struct){ 13 | } 14 | 1: (struct){ 15 | b: (int){ int } 16 | } 17 | } 18 | } 19 | #R: (#struct){ 20 | w: (list){ 21 | 0: (#struct){ 22 | } 23 | } 24 | } 25 | } 26 | -- out/compile -- 27 | --- in.cue 28 | { 29 | c: (〈0;#R〉 & { 30 | w: [ 31 | {}, 32 | { 33 | b: int 34 | }, 35 | ] 36 | }) 37 | #R: { 38 | w: [ 39 | {}, 40 | ..., 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /cue/testdata/eval/errunifiy.txtar: -------------------------------------------------------------------------------- 1 | Incomplete errors should not unify with values. 2 | 3 | -- in.cue -- 4 | a: or([]) 5 | a: "t" 6 | 7 | b: _|_ 8 | b: "t" 9 | 10 | -- out/eval -- 11 | Errors: 12 | explicit error (_|_ literal) in source: 13 | ./in.cue:4:4 14 | 15 | Result: 16 | (_|_){ 17 | // [user] 18 | a: (_|_){ 19 | // [incomplete] empty list in call to or: 20 | // ./in.cue:1:4 21 | } 22 | b: (_|_){ 23 | // [user] explicit error (_|_ literal) in source: 24 | // ./in.cue:4:4 25 | } 26 | } 27 | -- out/compile -- 28 | --- in.cue 29 | { 30 | a: or([]) 31 | a: "t" 32 | b: _|_(explicit error (_|_ literal) in source) 33 | b: "t" 34 | } 35 | -------------------------------------------------------------------------------- /doc/tutorial/basics/4_references/99_hidden.txt: -------------------------------------------------------------------------------- 1 | cue export hidden.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Hidden Fields" 6 | description = "" 7 | 8 | -- text.md -- 9 | A non-quoted field name that starts with an underscore (`_`) is not 10 | emitted from the output. 11 | To include fields in the configuration that start with an underscore 12 | put them in quotes. 13 | 14 | Quoted and non-quoted fields share the same namespace unless they start 15 | with an underscore. 16 | 17 | -- hidden.cue -- 18 | "_foo": 2 19 | _foo: 3 20 | foo: 4 21 | _#foo: 5 22 | 23 | -- expect-stdout-cue -- 24 | { 25 | "_foo": 2, 26 | "foo": 4 27 | } 28 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue269.txt: -------------------------------------------------------------------------------- 1 | cue eval ./struct.cue 2 | cmp stderr expect-stderr 3 | cmp stdout expect-stdout 4 | -- struct.cue -- 5 | #type: { 6 | x: 0 7 | y: 0 8 | 9 | if x == 0 {i: 0} 10 | if y == 0 {j: 0} 11 | } 12 | 13 | data: { 14 | a: #type 15 | b: #type 16 | 17 | b: x: a.x 18 | a: y: b.y 19 | } 20 | -- expect-stderr -- 21 | -- expect-stdout -- 22 | #type: { 23 | x: 0 24 | i: 0 25 | j: 0 26 | y: 0 27 | } 28 | data: { 29 | a: { 30 | x: 0 31 | i: 0 32 | j: 0 33 | y: 0 34 | } 35 | b: { 36 | x: 0 37 | i: 0 38 | j: 0 39 | y: 0 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cue/testdata/comprehensions/issue287.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | if #E["x"] != _|_ { 3 | #E: y: true 4 | } 5 | if #E["y"] != _|_ { 6 | z: true 7 | } 8 | #E: [_]: bool 9 | #E: x: true 10 | -- out/eval -- 11 | (struct){ 12 | #E: (#struct){ 13 | x: (bool){ true } 14 | y: (bool){ true } 15 | } 16 | z: (bool){ true } 17 | } 18 | -- out/compile -- 19 | --- in.cue 20 | { 21 | if (〈0;#E〉["x"] != _|_(explicit error (_|_ literal) in source)) { 22 | #E: { 23 | y: true 24 | } 25 | } 26 | if (〈0;#E〉["y"] != _|_(explicit error (_|_ literal) in source)) { 27 | z: true 28 | } 29 | #E: { 30 | [_]: bool 31 | } 32 | #E: { 33 | x: true 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /cue/testdata/eval/cycles_ref.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: b + 100 3 | b: a - 100 4 | a: 200 5 | 6 | 7 | c: d & { b: 2 } 8 | d: e 9 | e: { a: 1 } 10 | e: c 11 | -- out/eval -- 12 | (struct){ 13 | a: (int){ 200 } 14 | b: (int){ 100 } 15 | c: (struct){ 16 | a: (int){ 1 } 17 | b: (int){ 2 } 18 | } 19 | d: (struct){ 20 | a: (int){ 1 } 21 | b: (int){ 2 } 22 | } 23 | e: (struct){ 24 | a: (int){ 1 } 25 | b: (int){ 2 } 26 | } 27 | } 28 | -- out/compile -- 29 | --- in.cue 30 | { 31 | a: (〈0;b〉 + 100) 32 | b: (〈0;a〉 - 100) 33 | a: 200 34 | c: (〈0;d〉 & { 35 | b: 2 36 | }) 37 | d: 〈0;e〉 38 | e: { 39 | a: 1 40 | } 41 | e: 〈0;c〉 42 | } 43 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/manual/cue.mod: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | -------------------------------------------------------------------------------- /pkg/encoding/hex/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "encoding/hex" 5 | 6 | t1: hex.Encode("foo") 7 | t2: hex.Decode(hex.Encode("foo")) 8 | t3: hex.Decode("foo") 9 | t4: hex.Dump('foo') 10 | -- out/hex -- 11 | Errors: 12 | error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o': 13 | ./in.cue:5:5 14 | 15 | Result: 16 | t1: "666f6f" 17 | t2: 'foo' 18 | t3: _|_ // error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o' 19 | t4: """ 20 | 00000000 66 6f 6f |foo| 21 | 22 | """ 23 | 24 | -------------------------------------------------------------------------------- /pkg/time/testdata/gen.txtar: -------------------------------------------------------------------------------- 1 | # generated from the original tests. 2 | # Henceforth it may be nicer to group tests into separate files. 3 | -- in.cue -- 4 | import "time" 5 | 6 | t1: time.Time & "1937-01-01T12:00:27.87+00:20" 7 | t2: time.Time & "no time" 8 | t3: time.Unix(1500000000, 123456) 9 | -- out/time -- 10 | Errors: 11 | t2: invalid value "no time" (does not satisfy time.Time): error in call to time.Time: invalid time "no time": 12 | ./in.cue:4:17 13 | 14 | Result: 15 | t1: "1937-01-01T12:00:27.87+00:20" 16 | t2: _|_ // t2: invalid value "no time" (does not satisfy time.Time): error in call to time.Time: invalid time "no time" 17 | t3: "2017-07-14T02:40:00.000123456Z" 18 | 19 | -------------------------------------------------------------------------------- /cue/testdata/packages/embed.txtar: -------------------------------------------------------------------------------- 1 | cue eval ./pkg:foo 2 | 3 | -- cue.mod/module.cue -- 4 | module: "example.com" 5 | 6 | -- in.cue -- 7 | package foo 8 | 9 | import "example.com/pkg:bar" 10 | bar 11 | z: 3 12 | 13 | -- pkg/bar.cue -- 14 | package bar 15 | 16 | import "example.com/pkg:baz" 17 | foo: { 18 | baz 19 | y: 2 20 | } 21 | foo 22 | 23 | -- pkg/baz.cue -- 24 | package baz 25 | 26 | x: 1 27 | -- out/eval -- 28 | (struct){ 29 | foo: (struct){ 30 | x: (int){ 1 } 31 | y: (int){ 2 } 32 | } 33 | z: (int){ 3 } 34 | x: (int){ 1 } 35 | y: (int){ 2 } 36 | } 37 | -- out/compile -- 38 | --- in.cue 39 | { 40 | 〈import;"example.com/pkg:bar"〉 41 | z: 3 42 | } 43 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/proxy/authproxy/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: authproxy: spec: { 4 | // podTemplate defines the 'cookie cutter' used for creating 5 | // new pods when necessary 6 | template: { 7 | spec: { 8 | containers: [{ 9 | image: "skippy/oauth2_proxy:2.0.1" 10 | ports: [{ 11 | containerPort: 4180 12 | }] 13 | args: [ 14 | "--config=/etc/authproxy/authproxy.cfg", 15 | ] 16 | 17 | volumeMounts: [{ 18 | name: "config-volume" 19 | mountPath: "/etc/authproxy" 20 | }] 21 | }] 22 | volumes: [{ 23 | name: "config-volume" 24 | configMap: name: "authproxy" 25 | }] 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pkg/tool/cli/pkg.go: -------------------------------------------------------------------------------- 1 | // Code generated by go generate. DO NOT EDIT. 2 | 3 | //go:generate rm pkg.go 4 | //go:generate go run ../../gen/gen.go 5 | 6 | package cli 7 | 8 | import ( 9 | "cuelang.org/go/internal/core/adt" 10 | "cuelang.org/go/pkg/internal" 11 | ) 12 | 13 | func init() { 14 | internal.Register("tool/cli", pkg) 15 | } 16 | 17 | var _ = adt.TopKind // in case the adt package isn't used 18 | 19 | var pkg = &internal.Package{ 20 | Native: []*internal.Builtin{}, 21 | CUE: `{ 22 | Print: { 23 | $id: *"tool/cli.Print" | "print" 24 | text: string 25 | } 26 | Ask: { 27 | kind: "tool/cli.Ask" 28 | prompt: string 29 | response: string | bool 30 | } 31 | }`, 32 | } 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # CUE has moved to https://github.com/cue-lang/cue 18 | -------------------------------------------------------------------------------- /cue/testdata/definitions/visibility.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | #foo: { 3 | name: string 4 | } 5 | foo: #foo & { 6 | // These should all be allowed. 7 | _name: "foo" 8 | _#name: "bar" 9 | 10 | #name: "baz" 11 | } 12 | -- out/eval -- 13 | (struct){ 14 | #foo: (#struct){ 15 | name: (string){ string } 16 | } 17 | foo: (#struct){ 18 | name: (string){ string } 19 | _name: (string){ "foo" } 20 | _#name: (string){ "bar" } 21 | #name: (string){ "baz" } 22 | } 23 | } 24 | -- out/compile -- 25 | --- in.cue 26 | { 27 | #foo: { 28 | name: string 29 | } 30 | foo: (〈0;#foo〉 & { 31 | _name: "foo" 32 | _#name: "bar" 33 | #name: "baz" 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_http.txt: -------------------------------------------------------------------------------- 1 | cue cmd http 2 | cmp stdout cmd_http.out 3 | -- cmd_http.out -- 4 | {"data":"I'll be back!","when":"now"} 5 | 6 | -- task_tool.cue -- 7 | 8 | package home 9 | 10 | command: http: { 11 | task: testserver: { 12 | kind: "testserver" 13 | url: string 14 | } 15 | task: http: { 16 | kind: "http" 17 | method: "POST" 18 | url: task.testserver.url 19 | 20 | request: body: "I'll be back!" 21 | response: body: string // TODO: allow this to be a struct, parsing the body. 22 | } 23 | task: print: { 24 | kind: "print" 25 | text: task.http.response.body 26 | } 27 | } 28 | 29 | -- task.cue -- 30 | package home 31 | 32 | message: "Hello world!" 33 | -------------------------------------------------------------------------------- /cue/load/testdata/cue.mod/module.cue: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | module: "example.org/test" -------------------------------------------------------------------------------- /cue/load/testdata/sub/sub.cue: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 sub 16 | 17 | User: "sub" 18 | -------------------------------------------------------------------------------- /cue/testdata/cycle/patterns.txtar: -------------------------------------------------------------------------------- 1 | Lots of cycle-reference goodness. 2 | 3 | -- in.cue -- 4 | [!~"^[.]"]: c 5 | a: b 6 | b: [string]: int 7 | c: a: int 8 | [string]: c 9 | a: b 10 | b: [string]: int 11 | c: a: int 12 | 13 | -- out/eval -- 14 | (struct){ 15 | a: (struct){ 16 | a: (int){ int } 17 | } 18 | b: (struct){ 19 | a: (int){ int } 20 | } 21 | c: (struct){ 22 | a: (int){ int } 23 | } 24 | } 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | [!~"^[.]"]: 〈0;c〉 29 | a: 〈0;b〉 30 | b: { 31 | [string]: int 32 | } 33 | c: { 34 | a: int 35 | } 36 | [string]: 〈0;c〉 37 | a: 〈0;b〉 38 | b: { 39 | [string]: int 40 | } 41 | c: { 42 | a: int 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /cue/testdata/export/008.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | -- in.cue -- 4 | {a: [ 3 & 4]} 5 | -- out/def -- 6 | a: [_|_, // conflicting values 3 and 4 7 | ] 8 | -- out/compile -- 9 | --- in.cue 10 | { 11 | { 12 | a: [ 13 | (3 & 4), 14 | ] 15 | } 16 | } 17 | -- out/eval -- 18 | Errors: 19 | a.0: conflicting values 4 and 3: 20 | ./in.cue:1:1 21 | ./in.cue:1:7 22 | ./in.cue:1:11 23 | 24 | Result: 25 | (_|_){ 26 | // [eval] 27 | a: (_|_){ 28 | // [eval] 29 | 0: (_|_){ 30 | // [eval] a.0: conflicting values 4 and 3: 31 | // ./in.cue:1:1 32 | // ./in.cue:1:7 33 | // ./in.cue:1:11 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /cue/testdata/choosedefault/001_simple_disambiguation_conflict.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: simple disambiguation conflict 4 | #evalFull 5 | -- in.cue -- 6 | a: *"a" | "b" 7 | b: *"b" | "a" 8 | c: a & b 9 | -- out/def -- 10 | a: *"a" | "b" 11 | b: *"b" | "a" 12 | c: a & b 13 | -- out/legacy-debug -- 14 | <0>{a: "a", b: "b", c: ("a" | "b")} 15 | -- out/compile -- 16 | --- in.cue 17 | { 18 | a: (*"a"|"b") 19 | b: (*"b"|"a") 20 | c: (〈0;a〉 & 〈0;b〉) 21 | } 22 | -- out/eval -- 23 | (struct){ 24 | a: (string){ |(*(string){ "a" }, (string){ "b" }) } 25 | b: (string){ |(*(string){ "b" }, (string){ "a" }) } 26 | c: (string){ |((string){ "a" }, (string){ "b" }) } 27 | } 28 | -------------------------------------------------------------------------------- /cue/testdata/eval/resolve_basic.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: 1 3 | b: a + 1 4 | d: { 5 | x: _ 6 | y: b + x 7 | } 8 | e: d & { 9 | x: 5 10 | } 11 | 12 | -- out/eval -- 13 | (struct){ 14 | a: (int){ 1 } 15 | b: (int){ 2 } 16 | d: (struct){ 17 | x: (_){ _ } 18 | y: (_|_){ 19 | // [incomplete] d.y: non-concrete value _ in operand to +: 20 | // ./in.cue:5:6 21 | // ./in.cue:4:3 22 | } 23 | } 24 | e: (struct){ 25 | x: (int){ 5 } 26 | y: (int){ 7 } 27 | } 28 | } 29 | -- out/compile -- 30 | --- in.cue 31 | { 32 | a: 1 33 | b: (〈0;a〉 + 1) 34 | d: { 35 | x: _ 36 | y: (〈1;b〉 + 〈0;x〉) 37 | } 38 | e: (〈0;d〉 & { 39 | x: 5 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /cue/testdata/export/011.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | -- in.cue -- 5 | {a: {b: []}, c: a.b, d: a["b"]} 6 | -- out/def -- 7 | a: { 8 | b: [] 9 | } 10 | c: [] 11 | d: [] 12 | -- out/export -- 13 | a: { 14 | b: [] 15 | } 16 | c: [] 17 | d: [] 18 | -- out/yaml -- 19 | a: 20 | b: [] 21 | c: [] 22 | d: [] 23 | -- out/json -- 24 | {"a":{"b":[]},"c":[],"d":[]} 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | { 29 | a: { 30 | b: [] 31 | } 32 | c: 〈0;a〉.b 33 | d: 〈0;a〉["b"] 34 | } 35 | } 36 | -- out/eval -- 37 | (struct){ 38 | a: (struct){ 39 | b: (#list){ 40 | } 41 | } 42 | c: (#list){ 43 | } 44 | d: (#list){ 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /encoding/openapi/testdata/struct.json: -------------------------------------------------------------------------------- 1 | { 2 | "openapi": "3.0.0", 3 | "info": { 4 | "title": "Generated by cue.", 5 | "version": "no version" 6 | }, 7 | "paths": {}, 8 | "components": { 9 | "schemas": { 10 | "MyMap": { 11 | "type": "object", 12 | "minProperties": 4, 13 | "maxProperties": 9 14 | }, 15 | "MyType": { 16 | "type": "object", 17 | "required": [ 18 | "map" 19 | ], 20 | "properties": { 21 | "map": { 22 | "$ref": "#/components/schemas/MyMap" 23 | } 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/eval_context.txt: -------------------------------------------------------------------------------- 1 | cue eval --with-context -l '"\(path.Ext(filename)):\(index+1)/\(recordCount)"' -l 'data["@name"]' -s services.jsonl 2 | cmp stdout expect-stdout 3 | -- expect-stdout -- 4 | ".jsonl:1/3": elem1: { 5 | kind: "Service" 6 | "@name": "elem1" 7 | } 8 | ".jsonl:2/3": elem2: { 9 | kind: "Deployment" 10 | "@name": "elem2" 11 | } 12 | ".jsonl:3/3": elem3: { 13 | kind: "Service" 14 | "@name": "elem3" 15 | } 16 | -- services.jsonl -- 17 | { 18 | "kind": "Service", 19 | "@name": "elem1" 20 | } 21 | { 22 | "kind": "Deployment", 23 | "@name": "elem2" 24 | } 25 | { 26 | "kind": "Service", 27 | "@name": "elem3" 28 | } 29 | -- cue.mod -- 30 | -------------------------------------------------------------------------------- /doc/tutorial/basics/6_expressions/55_conditional.txt: -------------------------------------------------------------------------------- 1 | cue eval conditional.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Conditional Fields" 6 | description = "" 7 | 8 | -- text.md -- 9 | Field comprehensions can also be used to 10 | add a single field conditionally. 11 | 12 | Converting the resulting configuration to JSON results in an error 13 | as `justification` is required yet no concrete value is given. 14 | 15 | -- conditional.cue -- 16 | price: number 17 | 18 | // Require a justification if price is too high 19 | if price > 100 { 20 | justification: string 21 | } 22 | 23 | price: 200 24 | 25 | -- expect-stdout-cue -- 26 | price: 200 27 | justification: string 28 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/export_err.txt: -------------------------------------------------------------------------------- 1 | ! cue eval ./exporterr --out json 2 | cmp stdout expect-stdout 3 | cmp stderr expect-stderr 4 | 5 | ! cue eval ./exporterr -c 6 | cmp stdout expect-stdout 7 | cmp stderr expect-stderr 8 | 9 | ! cue export ./exporterr 10 | cmp stdout expect-stdout 11 | cmp stderr expect-stderr 12 | -- expect-stderr -- 13 | a.b.2.c: incomplete value int 14 | out: invalid interpolation: undefined field: d: 15 | ./exporterr/export_err.cue:7:6 16 | ./exporterr/export_err.cue:7:16 17 | -- expect-stdout -- 18 | -- exporterr/export_err.cue -- 19 | package exporterr 20 | 21 | a: b: [0, 1, {c: int}, 3] 22 | 23 | // Issue #553 24 | b: c: "hello" 25 | out: "d is \(b.d)" 26 | -- exporterr/cue.mod -- 27 | -------------------------------------------------------------------------------- /cue/testdata/resolve/014_null_coalescing.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: null coalescing 4 | #evalPartial 5 | -- in.cue -- 6 | a: null 7 | b: a.x | "b" 8 | c: a["x"] | "c" 9 | -- out/def -- 10 | a: null 11 | b: "b" 12 | c: "c" 13 | -- out/export -- 14 | a: null 15 | b: "b" 16 | c: "c" 17 | -- out/yaml -- 18 | a: null 19 | b: b 20 | c: c 21 | -- out/json -- 22 | {"a":null,"b":"b","c":"c"} 23 | -- out/legacy-debug -- 24 | <0>{a: null, b: "b", c: "c"} 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | a: null 29 | b: (〈0;a〉.x|"b") 30 | c: (〈0;a〉["x"]|"c") 31 | } 32 | -- out/eval -- 33 | (struct){ 34 | a: (null){ null } 35 | b: (string){ "b" } 36 | c: (string){ "c" } 37 | } 38 | -------------------------------------------------------------------------------- /encoding/jsonschema/testdata/openapi.txtar: -------------------------------------------------------------------------------- 1 | openapi 2 | 3 | -- type.yaml -- 4 | components: 5 | schemas: 6 | User: 7 | description: "A User uses something." 8 | type: object 9 | properties: 10 | id: 11 | type: integer 12 | name: 13 | type: string 14 | address: 15 | $ref: "#/components/schemas/PhoneNumber" 16 | nullable: true 17 | PhoneNumber: 18 | description: "The number to dial." 19 | type: string 20 | 21 | -- out.cue -- 22 | // A User uses something. 23 | #User: { 24 | id?: int 25 | name?: string 26 | address?: 27 | null | #PhoneNumber 28 | ... 29 | } 30 | 31 | // The number to dial. 32 | #PhoneNumber: string 33 | -------------------------------------------------------------------------------- /encoding/jsonschema/testdata/refroot.txtar: -------------------------------------------------------------------------------- 1 | // This test tests the conversion and ordering of $defs. 2 | 3 | -- definition.json -- 4 | { 5 | "$schema": "http://json-schema.org/draft-07/schema#", 6 | 7 | "$id": "http://cuelang.org/go/encoding/openapi/testdata/order.json", 8 | 9 | "properties": { 10 | "value": {}, 11 | "next": { "$ref": "#" } 12 | } 13 | } 14 | 15 | -- out.cue -- 16 | _schema 17 | _schema: { 18 | @jsonschema(schema="http://json-schema.org/draft-07/schema#") 19 | null | bool | number | string | [...] | { 20 | @jsonschema(id="http://cuelang.org/go/encoding/openapi/testdata/order.json") 21 | value?: _ 22 | next?: _schema_1 23 | ... 24 | } 25 | } 26 | 27 | let _schema_1 = _schema 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: FeatureRequest 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /cue/testdata/compile/erralias.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | let X = {} 3 | 4 | [Y="foo"]: 3 5 | a: Y 6 | 7 | "\(b)" :: 3 8 | b: "foo" 9 | 10 | c: {} 11 | for x in c { a: E } 12 | 13 | Z1=[Z2=string]: Z1+Z2 14 | 15 | -- out/compile -- 16 | unreferenced alias or let clause X: 17 | ./in.cue:1:1 18 | a: reference "Y" not found: 19 | ./in.cue:4:4 20 | definitions not supported for interpolations: 21 | ./in.cue:6:1 22 | for[].a: reference "E" not found: 23 | ./in.cue:10:17 24 | --- in.cue 25 | { 26 | ["foo"]: 3 27 | a: _|_(reference "Y" not found) 28 | "\(〈0;b〉)": 3 29 | b: "foo" 30 | c: {} 31 | for _, x in 〈0;c〉 { 32 | a: _|_(reference "E" not found) 33 | } 34 | [string]: (〈0;(〈0;-〉)〉 + 〈0;-〉) 35 | } 36 | -------------------------------------------------------------------------------- /cue/testdata/cycle/issue306.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: 12 3 | #Controller: settings: { 4 | controller: #Controller 5 | } 6 | 7 | -- out/eval -- 8 | Errors: 9 | #Controller.settings.controller: structural cycle 10 | 11 | Result: 12 | (_|_){ 13 | // [structural cycle] 14 | a: (int){ 12 } 15 | #Controller: (_|_){ 16 | // [structural cycle] 17 | settings: (_|_){ 18 | // [structural cycle] 19 | controller: (_|_){ 20 | // [structural cycle] #Controller.settings.controller: structural cycle 21 | } 22 | } 23 | } 24 | } 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | a: 12 29 | #Controller: { 30 | settings: { 31 | controller: 〈2;#Controller〉 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cue/testdata/references/package.txtar: -------------------------------------------------------------------------------- 1 | -- cue.mod/module.cue -- 2 | module: "example.com" 3 | 4 | -- in.cue -- 5 | package exitcode 6 | 7 | import ( 8 | pkg "foo.com/example" 9 | ) 10 | 11 | a: 1 12 | 13 | incomplete: pkg.Settings 14 | 15 | -- cue.mod/pkg/foo.com/example/example.cue -- 16 | package example 17 | 18 | // An incomplete error in a package is not transferred to a 19 | // package that is using it. 20 | // 21 | // Issue #550 22 | blah: Settings.anyKey 23 | Settings: {} 24 | 25 | -- out/ -- 26 | 27 | -- out/eval -- 28 | (struct){ 29 | a: (int){ 1 } 30 | incomplete: (struct){ 31 | } 32 | } 33 | -- out/compile -- 34 | --- in.cue 35 | { 36 | a: 1 37 | incomplete: 〈import;"foo.com/example"〉.Settings 38 | } 39 | -------------------------------------------------------------------------------- /doc/tutorial/basics/2_types/65_sumstruct.txt: -------------------------------------------------------------------------------- 1 | -- frontmatter.toml -- 2 | title = "Disjunctions of Structs" 3 | description = "" 4 | 5 | -- text.md -- 6 | Disjunctions work for any type. 7 | 8 | In this example we see that a `floor` of some specific house 9 | has an exit on level 0 and 1, but not on any other floor. 10 | 11 | -- sumstruct.cue -- 12 | // floor defines the specs of a floor in some house. 13 | floor: { 14 | level: int // the level on which this floor resides 15 | hasExit: bool // is there a door to exit the house? 16 | } 17 | 18 | // constraints on the possible values of floor. 19 | floor: { 20 | level: 0 | 1 21 | hasExit: true 22 | } | { 23 | level: -1 | 2 | 3 24 | hasExit: false 25 | } 26 | -------------------------------------------------------------------------------- /cue/testdata/fulleval/053_issue312.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: issue312 4 | #evalFull 5 | -- in.cue -- 6 | 7 | for x in [1] { 8 | *close({}) | {[_]: null} 9 | } 10 | -- out/def -- 11 | 12 | for x in [1] *close({}) | { 13 | [string]: null 14 | } 15 | -- out/export -- 16 | 17 | -- out/yaml -- 18 | {} 19 | -- out/json -- 20 | {} 21 | -- out/legacy-debug -- 22 | <0>{ <1>for _, x in [1] yield <2>{}, (*close (<3>{}) | <4>{[]: <5>(_: string)->null, })} 23 | -- out/eval -- 24 | (struct){ |(*(#struct){ 25 | }, (struct){ 26 | }) } 27 | -- out/compile -- 28 | --- in.cue 29 | { 30 | for _, x in [ 31 | 1, 32 | ] { 33 | (*close({})|{ 34 | [_]: null 35 | }) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/kitchen/dishwasher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: dishwasher: spec: { 4 | replicas: 5 5 | template: spec: { 6 | volumes: [{ 7 | }, { 8 | }, { 9 | name: "secret-ssh-key" 10 | secret: secretName: "dishwasher-secrets" 11 | }] 12 | containers: [{ 13 | image: "gcr.io/myproj/dishwasher:v0.2.13" 14 | volumeMounts: [{ 15 | }, { 16 | mountPath: "/sslcerts" 17 | }, { 18 | mountPath: "/etc/certs" 19 | name: "secret-ssh-key" 20 | readOnly: true 21 | }] 22 | args: [ 23 | "-env=prod", 24 | "-ssh-tunnel-key=/etc/certs/tunnel-private.pem", 25 | "-logdir=/logs", 26 | "-event-server=events:7788", 27 | ] 28 | }] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pkg/tool/generate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 tool 16 | 17 | //go:generate go run gen.go 18 | //go:generate go fmt 19 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/original/services/proxy/nginx/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: nginx 5 | labels: 6 | app: nginx 7 | component: proxy 8 | spec: 9 | type: LoadBalancer 10 | loadBalancerIP: 1.3.4.5 11 | ports: 12 | - port: 80 # the port that this service should serve on 13 | # the container on each pod to connect to, can be a name 14 | # (e.g. 'www') or a number (e.g. 80) 15 | targetPort: 80 16 | protocol: TCP 17 | name: http 18 | - port: 443 19 | protocol: TCP 20 | name: https 21 | # just like the selector in the replication controller, 22 | # but this time it identifies the set of pods to load balance 23 | # traffic to. 24 | selector: 25 | app: nginx -------------------------------------------------------------------------------- /tools/flow/testdata/cycle.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | root: { 3 | a: { 4 | $id: "valToOut" 5 | $after: c.$id 6 | } 7 | b: { 8 | $id: "valToOut" 9 | $after: a.$id 10 | out: "foo" 11 | } 12 | c: { 13 | $id: "valToOut" 14 | in: b.out 15 | } 16 | } 17 | -- out/run/errors -- 18 | error: cyclic task dependency: 19 | task root.a refers to 20 | task root.c refers to 21 | task root.b refers to 22 | task root.a: 23 | ./testdata/in.cue:2:5 24 | ./testdata/in.cue:6:5 25 | ./testdata/in.cue:11:5 26 | -- out/run/t0 -- 27 | graph TD 28 | t0("root.a [Waiting]") 29 | t0-->t2 30 | t1("root.b [Waiting]") 31 | t1-->t0 32 | t2("root.c [Waiting]") 33 | t2-->t1 34 | 35 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_print.txt: -------------------------------------------------------------------------------- 1 | cue cmd print 2 | cmp stdout expect-stdout 3 | 4 | -- expect-stdout -- 5 | t.1. 6 | .t.2. 7 | 8 | -- task_tool.cue -- 9 | package home 10 | 11 | import ( 12 | "tool/exec" 13 | "tool/cli" 14 | "strings" 15 | ) 16 | 17 | command: print: { 18 | runs: t1: exec.Run & { 19 | cmd: ["sh", "-c", "sleep 1; echo t1"] 20 | stdout: string 21 | } 22 | runs: t2: exec.Run & { 23 | cmd: ["sh", "-c", "sleep 1; echo t2"] 24 | stdout: string 25 | } 26 | print: cli.Print & { 27 | text: (#f & {arg: runs.t1.stdout + runs.t2.stdout}).result 28 | } 29 | } 30 | 31 | #f: { 32 | arg: string 33 | result: strings.Join(strings.Split(arg, ""), ".") 34 | } 35 | -- task.cue -- 36 | package home 37 | -- cue.mod -- 38 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/install_contributing.txt: -------------------------------------------------------------------------------- 1 | # Test that we can install tools required to contribute to the CUE 2 | # project using the pre Go 1.16 install method (which should also 3 | # work with Go 1.16) 4 | # 5 | # Keep this test in sync with all places that describe install 6 | # instructions for contributing 7 | 8 | [!long] skip 'Install tests use the network and take some time' 9 | 10 | # For this test we want to use the real proxy 11 | env GOPROXY=https://proxy.golang.org 12 | 13 | # Sanity check pre install 14 | ! exists $WORK/gopath/bin/git-codereview 15 | 16 | # Install 17 | env GO111MODULE=on 18 | go get golang.org/x/review/git-codereview 19 | exec $WORK/gopath/bin/git-codereview help 20 | stdout 'Git-codereview is a git helper' 21 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/issue476.txt: -------------------------------------------------------------------------------- 1 | cue cmd dostuffloop 2 | cmp stdout expect-stdout 3 | 4 | -- x_tool.cue -- 5 | package x 6 | 7 | import ( 8 | "tool/cli" 9 | "encoding/yaml" 10 | ) 11 | 12 | command: dostuff: { 13 | write: cli.Print & { 14 | text: "yaml is " + yaml.Marshal(w) 15 | } 16 | } 17 | 18 | command: dostuffloop: { 19 | for w in l { 20 | write: cli.Print & { 21 | text: "yaml is " + yaml.Marshal(w) 22 | } 23 | } 24 | } 25 | -- y.cue -- 26 | package x 27 | 28 | #Workflow: { 29 | #: "working-directory": string 30 | } 31 | 32 | l: [w] 33 | w: #Workflow & { 34 | } 35 | 36 | -- expect-stdout -- 37 | yaml is {} 38 | 39 | -------------------------------------------------------------------------------- /cue/load/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 load loads CUE instances. 16 | package load // import "cuelang.org/go/cue/load" 17 | -------------------------------------------------------------------------------- /cue/testdata/eval/let.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | let A = 3 * 3 3 | let B = A + A 4 | let C = B + B 5 | let D = C + C 6 | let E = D + D 7 | let F = E + E 8 | b: { 9 | let G = F + F 10 | let H = G + G 11 | let I = H + H 12 | let J = I + I 13 | let K = J + J 14 | let L = K + K 15 | let M = L + L 16 | let N = M + M 17 | let O = N + N 18 | let P = O + O 19 | let Q = P + P 20 | let R = Q + Q 21 | let S = R + R 22 | let T = S + S 23 | 24 | a: T 25 | b: F 26 | } 27 | -- out/eval -- 28 | (struct){ 29 | b: (struct){ 30 | a: (int){ 4718592 } 31 | b: (int){ 288 } 32 | } 33 | } 34 | -- out/compile -- 35 | --- in.cue 36 | { 37 | b: { 38 | a: 〈0;let T〉 39 | b: 〈1;let F〉 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/cue.mod/gen/k8s.io/apimachinery/pkg/runtime/helper_go_gen.cue: -------------------------------------------------------------------------------- 1 | // Code generated by cue get go. DO NOT EDIT. 2 | 3 | //cue:generate cue get go k8s.io/apimachinery/pkg/runtime 4 | 5 | package runtime 6 | 7 | // MultiObjectTyper returns the types of objects across multiple schemes in order. 8 | #MultiObjectTyper: [...#ObjectTyper] 9 | 10 | _#defaultFramer: { 11 | } 12 | 13 | // WithVersionEncoder serializes an object and ensures the GVK is set. 14 | #WithVersionEncoder: { 15 | Version: #GroupVersioner 16 | Encoder: #Encoder 17 | ObjectTyper: #ObjectTyper 18 | } 19 | 20 | // WithoutVersionDecoder clears the group version kind of a deserialized object. 21 | #WithoutVersionDecoder: { 22 | Decoder: #Decoder 23 | } 24 | -------------------------------------------------------------------------------- /cue/testdata/resolve/004.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #evalPartial 4 | -- in.cue -- 5 | a: _ 6 | b: a 7 | a: {d: 1, d: _} 8 | b: _ 9 | -- out/def -- 10 | a: { 11 | d: 1 12 | } 13 | b: a 14 | -- out/export -- 15 | a: { 16 | d: 1 17 | } 18 | b: { 19 | d: 1 20 | } 21 | -- out/yaml -- 22 | a: 23 | d: 1 24 | b: 25 | d: 1 26 | -- out/json -- 27 | {"a":{"d":1},"b":{"d":1}} 28 | -- out/legacy-debug -- 29 | <0>{a: <1>{d: 1}, b: <2>{d: 1}} 30 | -- out/compile -- 31 | --- in.cue 32 | { 33 | a: _ 34 | b: 〈0;a〉 35 | a: { 36 | d: 1 37 | d: _ 38 | } 39 | b: _ 40 | } 41 | -- out/eval -- 42 | (struct){ 43 | a: (struct){ 44 | d: (int){ 1 } 45 | } 46 | b: (struct){ 47 | d: (int){ 1 } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /doc/tutorial/basics/0_intro/50_order.txt: -------------------------------------------------------------------------------- 1 | cue eval -i order.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Order is irrelevant" 6 | description = "" 7 | 8 | -- text.md -- 9 | CUE's basic operations are defined in a way that the order in which 10 | you combine two configurations is irrelevant to the outcome. 11 | 12 | This is crucial property of CUE 13 | that makes it easy for humans _and_ machines to reason over values and 14 | makes advanced tooling and automation possible. 15 | 16 | -- order.cue -- 17 | a: {x: 1, y: int} 18 | a: {x: int, y: 2} 19 | 20 | b: {x: int, y: 2} 21 | b: {x: 1, y: int} 22 | 23 | -- expect-stdout-cue -- 24 | a: { 25 | x: 1 26 | y: 2 27 | } 28 | b: { 29 | x: 1 30 | y: 2 31 | } 32 | -------------------------------------------------------------------------------- /cue/testdata/fulleval/017_resolutions_in_struct_comprehension_keys.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: resolutions in struct comprehension keys 4 | #evalFull 5 | -- in.cue -- 6 | a: {for _, b in ["c"] {"\(b+".")": "a"}} 7 | -- out/def -- 8 | a: { 9 | "c.": "a" 10 | } 11 | -- out/export -- 12 | a: { 13 | "c.": "a" 14 | } 15 | -- out/yaml -- 16 | a: 17 | c.: a 18 | -- out/json -- 19 | {"a":{"c.":"a"}} 20 | -- out/legacy-debug -- 21 | <0>{a: <1>{"c.": "a"}} 22 | -- out/compile -- 23 | --- in.cue 24 | { 25 | a: { 26 | for _, b in [ 27 | "c", 28 | ] { 29 | "\((〈1;b〉 + "."))": "a" 30 | } 31 | } 32 | } 33 | -- out/eval -- 34 | (struct){ 35 | a: (struct){ 36 | "c.": (string){ "a" } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /doc/tutorial/kubernetes/quick/services/infra/watcher/kube.cue: -------------------------------------------------------------------------------- 1 | package kube 2 | 3 | deployment: watcher: spec: { 4 | // podTemplate defines the 'cookie cutter' used for creating 5 | // new pods when necessary 6 | template: { 7 | spec: { 8 | volumes: [{ 9 | name: "secret-volume" 10 | secret: secretName: "star-example-com-secrets" 11 | }] 12 | containers: [{ 13 | image: "gcr.io/myproj/watcher:v0.1.0" 14 | ports: [{ 15 | containerPort: 7080 16 | }, { 17 | containerPort: 7788 18 | }] 19 | volumeMounts: [{ 20 | mountPath: "/etc/ssl" 21 | name: "secret-volume" 22 | }] 23 | }] 24 | } 25 | } 26 | } 27 | 28 | deployment: watcher: spec: template: spec: containers: [{ports: [{_export: false}, _]}] 29 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/cmd_inferred.txt: -------------------------------------------------------------------------------- 1 | cue cmd dump 2 | cmp stdout expect-stdout 3 | -- f1.cue -- 4 | package kube 5 | 6 | pkg: { 7 | #Def: { 8 | a: int 9 | b: #Role 10 | } 11 | #Role: { 12 | kind: string 13 | name: string 14 | } 15 | 16 | } 17 | 18 | test: pkg.#Def 19 | test: { 20 | a: 1 21 | b: { 22 | kind: "foo" 23 | name: "bar" 24 | } 25 | } 26 | 27 | // A kind at the top-level should not be allowed. 28 | 29 | kind: "foo" 30 | $id: "bar" 31 | 32 | -- dump_tool.cue -- 33 | package kube 34 | 35 | import ( 36 | "tool/cli" 37 | "encoding/yaml" 38 | ) 39 | 40 | command: dump: { 41 | task: print: cli.Print & { text: yaml.Marshal(test) } 42 | } 43 | 44 | -- expect-stdout -- 45 | a: 1 46 | b: 47 | kind: foo 48 | name: bar 49 | 50 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/install_contributing_go1.16.txt: -------------------------------------------------------------------------------- 1 | # Test that we can install tools required to contribute to the CUE 2 | # project via the new Go 1.16 method 3 | # 4 | # Keep this test in sync with all places that describe install 5 | # instructions for contributing 6 | 7 | [!go1.16] skip 'Test only applies to Go 1.16' 8 | [!long] skip 'Install tests use the network and take some time' 9 | 10 | # For this test we want to use the real proxy 11 | env GOPROXY=https://proxy.golang.org 12 | 13 | # Sanity check pre install 14 | ! exists $WORK/gopath/bin/git-codereview 15 | 16 | # Install 17 | env GO111MODULE=on 18 | go install golang.org/x/review/git-codereview@latest 19 | exec $WORK/gopath/bin/git-codereview help 20 | stdout 'Git-codereview is a git helper' 21 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/vet_expr.txt: -------------------------------------------------------------------------------- 1 | ! cue vet -d '#File' vet.cue data.yaml 2 | cmp stderr expect-stderr 3 | 4 | -- expect-stderr -- 5 | translations.hello.lang: incomplete value string 6 | field not allowed: skip: 7 | ./data.yaml:20:1 8 | ./vet.cue:1:1 9 | ./vet.cue:1:8 10 | -- vet.cue -- 11 | #File: { 12 | translations: [string]: { 13 | lang: string 14 | text: string 15 | } 16 | } 17 | -- data.yaml -- 18 | # translated messages 19 | translations: 20 | hello: 21 | lang: gsw 22 | text: Grüetzi 23 | --- 24 | translations: 25 | hello: 26 | text: Hoi 27 | --- 28 | translations: 29 | hello: 30 | lang: no 31 | text: Hallo 32 | --- 33 | translations: 34 | hello: 35 | lang: nl 36 | text: Hallo 37 | skip: true 38 | -------------------------------------------------------------------------------- /cue/testdata/export/018.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | raw: true 4 | -- in.cue -- 5 | {a: [1, 2], b: [ for k, v in a {v}]} 6 | -- out/def -- 7 | a: [1, 2] 8 | b: [1, 2] 9 | -- out/export -- 10 | a: [1, 2] 11 | b: [1, 2] 12 | -- out/yaml -- 13 | a: 14 | - 1 15 | - 2 16 | b: 17 | - 1 18 | - 2 19 | -- out/json -- 20 | {"a":[1,2],"b":[1,2]} 21 | -- out/compile -- 22 | --- in.cue 23 | { 24 | { 25 | a: [ 26 | 1, 27 | 2, 28 | ] 29 | b: [ 30 | for k, v in 〈0;a〉 { 31 | 〈1;v〉 32 | }, 33 | ] 34 | } 35 | } 36 | -- out/eval -- 37 | (struct){ 38 | a: (#list){ 39 | 0: (int){ 1 } 40 | 1: (int){ 2 } 41 | } 42 | b: (#list){ 43 | 0: (int){ 1 } 44 | 1: (int){ 2 } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/get_go_type_errors.txt: -------------------------------------------------------------------------------- 1 | # Test that we get expected results in the presence of type 2 | # check errors. In this mode, cue get go proceeds on a best-efforts 3 | # basis. 4 | 5 | cue get go --local 6 | cmp blah_go_gen.cue blah.cue.golden 7 | 8 | -- go.mod -- 9 | module mod.com/blah 10 | 11 | go 1.14 12 | -- go.mod.golden -- 13 | module mod.com/blah 14 | 15 | go 1.14 16 | -- blah.go -- 17 | package main 18 | 19 | import _ "embed" 20 | 21 | // go:embed blah.txt 22 | var blah string 23 | 24 | // Syntax error 25 | type S 26 | 27 | type T struct { 28 | Age int 29 | } 30 | 31 | -- blah.cue.golden -- 32 | // Code generated by cue get go. DO NOT EDIT. 33 | 34 | //cue:generate cue get go mod.com/blah 35 | 36 | package main 37 | 38 | #T: Age: int 39 | -------------------------------------------------------------------------------- /doc/tutorial/basics/4_references/85_cycleref.txt: -------------------------------------------------------------------------------- 1 | cue eval cycleref.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Cycles in Fields" 6 | description = "" 7 | 8 | -- text.md -- 9 | Also, we know that unifying a field with itself will result in the same value. 10 | Thus if we have a cycle between some fields, all we need to do is ignore 11 | the cycle and unify their values once to achieve the same result as 12 | merging them ad infinitum. 13 | 14 | -- cycleref.cue -- 15 | labels: selectors 16 | labels: {app: "foo"} 17 | 18 | selectors: labels 19 | selectors: {name: "bar"} 20 | 21 | -- expect-stdout-cue -- 22 | labels: { 23 | name: "bar" 24 | app: "foo" 25 | } 26 | selectors: { 27 | name: "bar" 28 | app: "foo" 29 | } 30 | -------------------------------------------------------------------------------- /cue/testdata/compile/json.txtar: -------------------------------------------------------------------------------- 1 | Issue #721 2 | 3 | -- in.cue -- 4 | // allow front-style commas 5 | a 6 | : { "key": "value" 7 | , "key2" 8 | : "value2" 9 | } 10 | 11 | , b: [ 12 | 0 13 | , 1 14 | , 2 15 | ,3, 16 | 4 17 | 18 | , 5 19 | ] 20 | -- out/compile -- 21 | --- in.cue 22 | { 23 | a: { 24 | key: "value" 25 | key2: "value2" 26 | } 27 | b: [ 28 | 0, 29 | 1, 30 | 2, 31 | 3, 32 | 4, 33 | 5, 34 | ] 35 | } 36 | -- out/eval -- 37 | (struct){ 38 | a: (struct){ 39 | key: (string){ "value" } 40 | key2: (string){ "value2" } 41 | } 42 | b: (#list){ 43 | 0: (int){ 0 } 44 | 1: (int){ 1 } 45 | 2: (int){ 2 } 46 | 3: (int){ 3 } 47 | 4: (int){ 4 } 48 | 5: (int){ 5 } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /doc/tutorial/basics/0_intro/30_duplicates.txt: -------------------------------------------------------------------------------- 1 | cue eval dup.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Duplicate Fields" 6 | description = "" 7 | 8 | -- text.md -- 9 | CUE allows duplicated field definitions as long as they don't conflict. 10 | 11 | For values of basic types this means they must be equal. 12 | 13 | For structs, fields are merged and duplicated fields are handled recursively. 14 | 15 | For lists, all elements must match accordingly 16 | 17 | 18 | -- dup.cue -- 19 | a: 4 20 | a: 4 21 | 22 | s: { b: 2 } 23 | s: { c: 2 } 24 | 25 | l: [ 1, 2 ] 26 | l: [ 1, 2 ] 27 | 28 | -- expect-stdout-cue -- 29 | a: 4 30 | s: { 31 | b: 2 32 | c: 2 33 | } 34 | l: [1, 2] 35 | -------------------------------------------------------------------------------- /pkg/text/tabwriter/pkg.go: -------------------------------------------------------------------------------- 1 | // Code generated by go generate. DO NOT EDIT. 2 | 3 | //go:generate rm pkg.go 4 | //go:generate go run ../../gen/gen.go 5 | 6 | package tabwriter 7 | 8 | import ( 9 | "cuelang.org/go/internal/core/adt" 10 | "cuelang.org/go/pkg/internal" 11 | ) 12 | 13 | func init() { 14 | internal.Register("text/tabwriter", pkg) 15 | } 16 | 17 | var _ = adt.TopKind // in case the adt package isn't used 18 | 19 | var pkg = &internal.Package{ 20 | Native: []*internal.Builtin{{ 21 | Name: "Write", 22 | Params: []internal.Param{ 23 | {Kind: adt.TopKind}, 24 | }, 25 | Result: adt.StringKind, 26 | Func: func(c *internal.CallCtxt) { 27 | data := c.Value(0) 28 | if c.Do() { 29 | c.Ret, c.Err = Write(data) 30 | } 31 | }, 32 | }}, 33 | } 34 | -------------------------------------------------------------------------------- /cue/testdata/eval/issue353.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | e: #Example 3 | 4 | e: a: "hello" 5 | 6 | #Example: { 7 | a: string 8 | { 9 | value?: string 10 | } | { 11 | externalValue?: string 12 | } 13 | } 14 | -- out/eval -- 15 | (struct){ 16 | e: (#struct){ |((#struct){ 17 | a: (string){ "hello" } 18 | }, (#struct){ 19 | a: (string){ "hello" } 20 | }) } 21 | #Example: (#struct){ |((#struct){ 22 | a: (string){ string } 23 | }, (#struct){ 24 | a: (string){ string } 25 | }) } 26 | } 27 | -- out/compile -- 28 | --- in.cue 29 | { 30 | e: 〈0;#Example〉 31 | e: { 32 | a: "hello" 33 | } 34 | #Example: { 35 | a: string 36 | ({ 37 | value?: string 38 | }|{ 39 | externalValue?: string 40 | }) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: dont pass incomplete values to builtins 4 | #evalFull 5 | -- in.cue -- 6 | import "encoding/json" 7 | 8 | input: string 9 | foo: json.Marshal(input) 10 | -- out/def -- 11 | import "encoding/json" 12 | 13 | input: string 14 | foo: json.Marshal(input) 15 | -- out/legacy-debug -- 16 | <0>{input: string, foo: <1>.Marshal (<2>.input)} 17 | -- out/eval -- 18 | (struct){ 19 | input: (string){ string } 20 | foo: (_|_){ 21 | // [incomplete] foo: non-concrete argument 0: 22 | // ./in.cue:4:8 23 | } 24 | } 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | input: string 29 | foo: 〈import;"encoding/json"〉.Marshal(〈0;input〉) 30 | } 31 | -------------------------------------------------------------------------------- /doc/tutorial/basics/2_types/48_bytes.txt: -------------------------------------------------------------------------------- 1 | cue export bytes.cue 2 | cmp stdout expect-stdout-cue 3 | 4 | -- frontmatter.toml -- 5 | title = "Bytes" 6 | description = "" 7 | 8 | -- text.md -- 9 | CUE distinguishes between a `string` and a `bytes` type. 10 | Bytes are converted to base64 when emitting JSON. 11 | Byte literals are defined with single quotes. 12 | The following additional escape sequences are allowed in byte literals: 13 | 14 | \xnn // arbitrary byte value defined as a 2-digit hexadecimal number 15 | \nnn // arbitrary byte value defined as a 3-digit octal number 16 | 17 | 18 | -- bytes.cue -- 19 | a: '\x03abc' 20 | 21 | -- expect-stdout-cue -- 22 | { 23 | "a": "A2FiYw==" 24 | } 25 | -------------------------------------------------------------------------------- /cue/build/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 build defines collections of CUE files to build an instance. 16 | package build // import "cuelang.org/go/cue/build" 17 | -------------------------------------------------------------------------------- /cue/literal/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 literal implements conversions to and from string representations of 16 | // basic data types. 17 | package literal 18 | -------------------------------------------------------------------------------- /cue/testdata/fulleval/013_normalization.txtar: -------------------------------------------------------------------------------- 1 | TODO: the new evaluator currently does not normalize disjuncts. 2 | It needs to be determined under which circumstances is desirable. 3 | The redundancy that remains from not normalizing can be useful. 4 | 5 | #name: normalization 6 | #evalFull 7 | -- in.cue -- 8 | a: string | string 9 | b: *1 | *int 10 | c: *1.0 | *float 11 | -- out/def -- 12 | a: string 13 | b: int 14 | c: float 15 | -- out/legacy-debug -- 16 | <0>{a: string, b: int, c: float} 17 | -- out/compile -- 18 | --- in.cue 19 | { 20 | a: (string|string) 21 | b: (*1|*int) 22 | c: (*1.0|*float) 23 | } 24 | -- out/eval -- 25 | (struct){ 26 | a: (string){ string } 27 | b: (int){ |(*(int){ 1 }, *(int){ int }) } 28 | c: (float){ |(*(float){ 1.0 }, *(float){ float }) } 29 | } 30 | -------------------------------------------------------------------------------- /encoding/jsonschema/testdata/emptyobj.txtar: -------------------------------------------------------------------------------- 1 | // Objects without properties should convert correctly. 2 | // 3 | // Issue #734 4 | -- github-workflow.json -- 5 | { 6 | "$schema": "http://json-schema.org/draft-07/schema", 7 | "definitions": { 8 | "obj1": { 9 | "oneOf": [ 10 | { 11 | "type": "object" 12 | }, 13 | { 14 | "type": "null" 15 | } 16 | ], 17 | "additionalProperties": true 18 | }, 19 | "obj2": { 20 | "type": [ "object", "null" ], 21 | "additionalProperties": true 22 | } 23 | } 24 | } 25 | -- out.err -- 26 | -- out.cue -- 27 | @jsonschema(schema="http://json-schema.org/draft-07/schema") 28 | _ 29 | 30 | #obj1: null | { 31 | ... 32 | } 33 | 34 | #obj2: null | { 35 | ... 36 | } 37 | -------------------------------------------------------------------------------- /cmd/cue/cmd/testdata/script/vet_data.txt: -------------------------------------------------------------------------------- 1 | ! cue vet schema.cue data.yaml 2 | cmp stderr vet-stderr 3 | 4 | ! cue export schema.cue data.yaml 5 | cmp stderr export-stderr 6 | 7 | -- schema.cue -- 8 | #Language: { 9 | tag: string 10 | name: =~"^\\p{Lu}" // Must start with an uppercase letter. 11 | } 12 | languages: [...#Language] 13 | 14 | -- data.yaml -- 15 | languages: 16 | - tag: en 17 | name: English 18 | - tag: nl 19 | name: dutch 20 | - tag: no 21 | name: Norwegian 22 | 23 | -- vet-stderr -- 24 | languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"): 25 | ./schema.cue:3:8 26 | ./data.yaml:5:12 27 | -- export-stderr -- 28 | languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"): 29 | ./schema.cue:3:8 30 | ./data.yaml:5:12 31 | -------------------------------------------------------------------------------- /cue/testdata/builtins/issue299.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | import "list" 3 | x: list.UniqueItems 4 | x: [string, ...string] 5 | x: ["x","x"] 6 | -- out/eval -- 7 | Errors: 8 | x: invalid value ["x","x"] (does not satisfy list.UniqueItems): 9 | ./in.cue:2:1 10 | ./in.cue:3:1 11 | ./in.cue:4:1 12 | 13 | Result: 14 | (_|_){ 15 | // [eval] 16 | x: (_|_){ 17 | // [eval] x: invalid value ["x","x"] (does not satisfy list.UniqueItems): 18 | // ./in.cue:2:1 19 | // ./in.cue:3:1 20 | // ./in.cue:4:1 21 | 0: (string){ "x" } 22 | 1: (string){ "x" } 23 | } 24 | } 25 | -- out/compile -- 26 | --- in.cue 27 | { 28 | x: 〈import;list〉.UniqueItems 29 | x: [ 30 | string, 31 | ...string, 32 | ] 33 | x: [ 34 | "x", 35 | "x", 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /cue/testdata/definitions/defembed.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | a: { 3 | #A 4 | } 5 | 6 | a: c: 1 7 | 8 | #A: b: 1 9 | -- out/eval -- 10 | Errors: 11 | a: field not allowed: c: 12 | ./in.cue:1:4 13 | ./in.cue:2:5 14 | ./in.cue:5:4 15 | ./in.cue:7:5 16 | 17 | Result: 18 | (_|_){ 19 | // [eval] 20 | a: (_|_){ 21 | // [eval] 22 | b: (int){ 1 } 23 | c: (_|_){ 24 | // [eval] a: field not allowed: c: 25 | // ./in.cue:1:4 26 | // ./in.cue:2:5 27 | // ./in.cue:5:4 28 | // ./in.cue:7:5 29 | } 30 | } 31 | #A: (#struct){ 32 | b: (int){ 1 } 33 | } 34 | } 35 | -- out/compile -- 36 | --- in.cue 37 | { 38 | a: { 39 | 〈1;#A〉 40 | } 41 | a: { 42 | c: 1 43 | } 44 | #A: { 45 | b: 1 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cue/testdata/fulleval/047_dont_bind_to_string_labels.txtar: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT; generated by go run testdata/gen.go 2 | # 3 | #name: dont bind to string labels 4 | #evalFull 5 | -- in.cue -- 6 | x: 1 7 | y: { 8 | "x": 2 9 | z: x 10 | } 11 | -- out/def -- 12 | x: 1 13 | y: { 14 | x: 2 15 | z: 1 16 | } 17 | -- out/export -- 18 | x: 1 19 | y: { 20 | x: 2 21 | z: 1 22 | } 23 | -- out/yaml -- 24 | x: 1 25 | y: 26 | x: 2 27 | z: 1 28 | -- out/json -- 29 | {"x":1,"y":{"x":2,"z":1}} 30 | -- out/legacy-debug -- 31 | <0>{x: 1, y: <1>{x: 2, z: 1}} 32 | -- out/compile -- 33 | --- in.cue 34 | { 35 | x: 1 36 | y: { 37 | x: 2 38 | z: 〈1;x〉 39 | } 40 | } 41 | -- out/eval -- 42 | (struct){ 43 | x: (int){ 1 } 44 | y: (struct){ 45 | x: (int){ 2 } 46 | z: (int){ 1 } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /cue/scanner/corpus/+basic.cue: -------------------------------------------------------------------------------- 1 | /* a comment */ 2 | /* 3 | */ 4 | @foo() 5 | @foo(,,) 6 | @foo(a) 7 | @foo(aa=b) 8 | @foo(,a=b) 9 | @foo(",a=b") 10 | @foo(##"\(),a=b"##) 11 | @foo("",a="") 12 | _|_ 13 | foobar 14 | a۰۱۸ 15 | foo६४ 16 | bar9876 17 | ŝ 18 | ŝfoo 19 | 0 20 | 1 21 | 123456789012345678890 22 | 12345_67890_12345_6788_90 23 | 1234567M 24 | 1234567Mi 25 | 1234567 26 | .3Mi 27 | 3.3Mi 28 | 0xcafebabe 29 | 0b1100_1001 30 | 0o1234567 31 | 0. 32 | .0 33 | 3.14159265 34 | 1e0 35 | 1e+100 36 | 1e-100 37 | 2.71828e-1000 38 | 'a' 39 | '\\000' 40 | '\\xFF' 41 | '\\uff16' 42 | '\\uD801' 43 | '\\U0000ff16' 44 | 'foobar' 45 | 'foo\/bar' 46 | #" ""# 47 | #"foobar"# 48 | #"\r"# 49 | #"\("# 50 | #"\q"# 51 | ###"\##q"### 52 | "foobar" 53 | """ 54 | foobar 55 | """ 56 | #""" 57 | \(foobar 58 | """# 59 | -------------------------------------------------------------------------------- /cue/testdata/eval/basictypes.txtar: -------------------------------------------------------------------------------- 1 | -- in.cue -- 2 | top: { 3 | a: {_} 4 | b: _ 5 | } 6 | 7 | scalar: { 8 | a: {string} 9 | b: string 10 | c: {{{number}}} 11 | d: number 12 | } 13 | -- out/eval -- 14 | (struct){ 15 | top: (struct){ 16 | a: (_){ _ } 17 | b: (_){ _ } 18 | } 19 | scalar: (struct){ 20 | a: (string){ string } 21 | b: (string){ string } 22 | c: (number){ number } 23 | d: (number){ number } 24 | } 25 | } 26 | -- out/compile -- 27 | --- in.cue 28 | { 29 | top: { 30 | a: { 31 | _ 32 | } 33 | b: _ 34 | } 35 | scalar: { 36 | a: { 37 | string 38 | } 39 | b: string 40 | c: { 41 | { 42 | { 43 | number 44 | } 45 | } 46 | } 47 | d: number 48 | } 49 | } 50 | --------------------------------------------------------------------------------