Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
ksonnet
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ijaz Ahmad
ksonnet
Commits
727fc768
Commit
727fc768
authored
7 years ago
by
bryanl
Browse files
Options
Downloads
Patches
Plain Diff
pulling in up to ksonnet-lib
Signed-off-by:
bryanl
<
bryanliles@gmail.com
>
parent
e570bff8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Gopkg.lock
+1
-1
1 addition, 1 deletion
Gopkg.lock
Gopkg.toml
+1
-1
1 addition, 1 deletion
Gopkg.toml
vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/astext/astext.go
+35
-1
35 additions, 1 deletion
...thub.com/ksonnet/ksonnet-lib/ksonnet-gen/astext/astext.go
with
37 additions
and
3 deletions
Gopkg.lock
+
1
−
1
View file @
727fc768
...
...
@@ -232,7 +232,7 @@
"ksonnet-gen/nodemaker",
"ksonnet-gen/printer"
]
revision = "
9f27c242ff65da0620f8324cc0cd50c8ef00bf5b
"
revision = "
152e1979764f713239ca25bcb0f3315e69215119
"
[[projects]]
branch = "master"
...
...
This diff is collapsed.
Click to expand it.
Gopkg.toml
+
1
−
1
View file @
727fc768
...
...
@@ -54,7 +54,7 @@
[[constraint]]
name
=
"github.com/ksonnet/ksonnet-lib"
revision
=
"
9f27c242ff65da0620f8324cc0cd50c8ef00bf5b
"
revision
=
"
152e1979764f713239ca25bcb0f3315e69215119
"
[[constraint]]
name
=
"github.com/mattn/go-isatty"
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/astext/astext.go
+
35
−
1
View file @
727fc768
package
astext
import
"github.com/google/go-jsonnet/ast"
import
(
"regexp"
"github.com/google/go-jsonnet/ast"
"github.com/pkg/errors"
)
// ObjectFields is a slice of ObjectField.
type
ObjectFields
[]
ObjectField
...
...
@@ -26,3 +31,32 @@ type Object struct {
// Oneline prints this field on a single line.
Oneline
bool
}
var
(
// reFieldStr matches a field id that should be enclosed in quotes.
reFieldStr
=
regexp
.
MustCompile
(
`^[A-Za-z]+[A-Za-z0-9\-]*$`
)
// reField matches a field id.
reField
=
regexp
.
MustCompile
(
`^[A-Za-z]+[A-Za-z0-9]*$`
)
)
// CreateField creates an ObjectField with a name. If the name matches `reFieldStr`, it will
// create an ObjectField with Kind `ObjectFieldStr`. If not, it will create an identifier
// and set the ObjectField kind to `ObjectFieldId`.
func
CreateField
(
name
string
)
(
*
ObjectField
,
error
)
{
of
:=
ObjectField
{
ObjectField
:
ast
.
ObjectField
{}}
if
reField
.
MatchString
(
name
)
{
id
:=
ast
.
Identifier
(
name
)
of
.
Kind
=
ast
.
ObjectFieldID
of
.
Id
=
&
id
}
else
if
reFieldStr
.
MatchString
(
name
)
{
of
.
Expr1
=
&
ast
.
LiteralString
{
Value
:
name
,
Kind
:
ast
.
StringDouble
,
}
of
.
Kind
=
ast
.
ObjectFieldStr
}
else
{
return
nil
,
errors
.
Errorf
(
"invalid field name %q"
,
name
)
}
return
&
of
,
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment