go.fuchsia.dev/infra@v0.0.0-20240507153436-9b593402251b/cmd/submodule_update/base.go (about)

     1  // Copyright 2023 The Fuchsia Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  package main
     5  
     6  import (
     7  	"errors"
     8  	"flag"
     9  )
    10  
    11  type baseCmd struct {
    12  	jsonInput  string
    13  	jsonOutput string
    14  }
    15  
    16  func (b *baseCmd) SetFlags(f *flag.FlagSet) {
    17  	f.StringVar(&b.jsonInput, "json-input", "", "Path to JSON inputs.")
    18  	f.StringVar(&b.jsonOutput, "json-output", "", "Path to output results.")
    19  }
    20  
    21  func (b *baseCmd) checkSuperproject() error {
    22  	if b.jsonInput == "" {
    23  		return errors.New("json-input flag is required")
    24  	}
    25  	return nil
    26  }