Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module(
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# NB: update_cpp_jsonnet.sh looks for these.
CPP_JSONNET_SHA256 = "c170422f8fe719e607f101232361fe7601e6304336e02ae47f25d2aa963b84ae"
CPP_JSONNET_SHA256 = "11f93ddebd2255d6dcddfe73142ed6ce85715290d2b2f500effab7dfbdf4dd51"

CPP_JSONNET_GITHASH = "833f18402b6b6a2da0b2fae75446a1e14b9116dd"
CPP_JSONNET_GITHASH = "3a7b2a565827635615f8a9432d94941e2a827c70"

CPP_JSONNET_RELEASE_VERSION = ""

Expand Down
14 changes: 11 additions & 3 deletions cmd/jsonnetfmt/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,12 @@ func main() {
// Should already have been caught by processArgs.
panic("Internal error: expected at least one input file.")
}
changedFiles := false
for _, inputFile := range config.inputFiles {
outputFile := inputFile
inputIsStdin := inputFile == "-"
if config.inPlace {
if inputFile == "-" {
if inputIsStdin {
fmt.Fprintf(os.Stderr, "ERROR: cannot use --in-place with stdin\n")
os.Exit(1)
}
Expand All @@ -267,18 +269,24 @@ func main() {
}

if output != input {
changedFiles = true
if config.inPlace {
err := cmd.WriteOutputFile(output, outputFile, false)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
} else {
os.Exit(2)
}
if !config.filenameIsCode && !inputIsStdin {
fmt.Println(inputFile)
}
}
}

if changedFiles && config.test {
os.Exit(2)
}

} else {
if len(config.inputFiles) != 1 {
// Should already have been caught by processArgs.
Expand Down
Loading