blob: 5a0245eeb331e6ee3808880ecdf273579f12df68 [file] [log] [blame]
// Copyright 2023 The Shac Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package shac is shac's CLI executable.
package main
import (
"errors"
"fmt"
"os"
flag "github.com/spf13/pflag"
"go.fuchsia.dev/shac-project/shac/internal/cli"
"go.fuchsia.dev/shac-project/shac/internal/engine"
)
func main() {
if err := cli.Main(os.Args); err != nil && !errors.Is(err, flag.ErrHelp) {
var stackerr engine.BacktracableError
if errors.As(err, &stackerr) {
_, _ = os.Stderr.WriteString(stackerr.Backtrace())
}
_, _ = fmt.Fprintf(os.Stderr, "shac: %s\n", err)
os.Exit(1)
}
}