Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Added version command
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoltzsche committed Oct 21, 2018
1 parent 6feaa01 commit 5113e49
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright © 2017 Max Goltzsche
//
// 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 main

import (
"fmt"

"github.com/mgoltzsche/ctnr/cmd"
"github.com/spf13/cobra"
)

var (
version = "dev"
commit = "none"
date = "unknown"
versionCmd = &cobra.Command{
Use: "version",
Short: "print version",
Long: `print version.`,
Run: func(_ *cobra.Command, args []string) {
fmt.Printf("version: %s\ncommit: %s\ndate: %s\n", version, commit, date)
},
}
)

func init() {
cmd.RootCmd.AddCommand(versionCmd)
}

0 comments on commit 5113e49

Please sign in to comment.