Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nova-password
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
nova-password
Commits
bce9cd9b
Commit
bce9cd9b
authored
5 years ago
by
kayrus
Browse files
Options
Downloads
Patches
Plain Diff
Add --version flag
Resolves #4
parent
f554ce08
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+5
-3
5 additions, 3 deletions
Makefile
README.md
+1
-0
1 addition, 0 deletions
README.md
main.go
+3
-0
3 additions, 0 deletions
main.go
with
9 additions
and
3 deletions
Makefile
+
5
−
3
View file @
bce9cd9b
...
@@ -2,15 +2,17 @@ PKG:=github.com/sapcc/nova-password
...
@@ -2,15 +2,17 @@ PKG:=github.com/sapcc/nova-password
APP_NAME
:=
nova-password
APP_NAME
:=
nova-password
PWD
:=
$(
shell
pwd
)
PWD
:=
$(
shell
pwd
)
UID
:=
$(
shell
id
-u
)
UID
:=
$(
shell
id
-u
)
VERSION
:=
$(
shell git describe
--tags
--always
--dirty
=
"-dev"
)
LDFLAGS
:=
-X
main.Version
=
$(
VERSION
)
export
GO111MODULE
:=
off
export
GO111MODULE
:=
off
export
GOPATH
:=
$(
PWD
)
/gopath
export
GOPATH
:=
$(
PWD
)
/gopath
export
CGO_ENABLED
:=
0
export
CGO_ENABLED
:=
0
build
:
gopath/src/$(PKG) fmt
build
:
gopath/src/$(PKG) fmt
GOOS
=
linux go build
-o
bin/
$(
APP_NAME
)
$(
PKG
)
GOOS
=
linux go build
-ldflags
=
"
$(
LDFLAGS
)
"
-o
bin/
$(
APP_NAME
)
$(
PKG
)
GOOS
=
darwin go build
-o
bin/
$(
APP_NAME
)
_darwin
$(
PKG
)
GOOS
=
darwin go build
-ldflags
=
"
$(
LDFLAGS
)
"
-o
bin/
$(
APP_NAME
)
_darwin
$(
PKG
)
GOOS
=
windows go build
-o
bin/
$(
APP_NAME
)
.exe
$(
PKG
)
GOOS
=
windows go build
-ldflags
=
"
$(
LDFLAGS
)
"
-o
bin/
$(
APP_NAME
)
.exe
$(
PKG
)
docker
:
docker
:
docker run
-ti
--rm
-e
GOCACHE
=
/tmp
-v
$(
PWD
)
:/
$(
APP_NAME
)
-u
$(
UID
)
:
$(
UID
)
--workdir
/
$(
APP_NAME
)
golang:latest make
docker run
-ti
--rm
-e
GOCACHE
=
/tmp
-v
$(
PWD
)
:/
$(
APP_NAME
)
-u
$(
UID
)
:
$(
UID
)
--workdir
/
$(
APP_NAME
)
golang:latest make
...
...
This diff is collapsed.
Click to expand it.
README.md
+
1
−
0
View file @
bce9cd9b
...
@@ -10,6 +10,7 @@ Flags:
...
@@ -10,6 +10,7 @@ Flags:
-d
,
--debug
print out request and response objects
-d
,
--debug
print out request and response objects
-h
,
--help
help
for
nova-password
-h
,
--help
help
for
nova-password
-i
,
--private-key-path
string a path to the RSA private key
(
PuTTY and OpenSSH formats
)
(
default
"~/.ssh/id_rsa"
)
-i
,
--private-key-path
string a path to the RSA private key
(
PuTTY and OpenSSH formats
)
(
default
"~/.ssh/id_rsa"
)
--version
version
for
nova-password
-w
,
--wait
uint
wait
for
the password
timeout
in
seconds
-w
,
--wait
uint
wait
for
the password
timeout
in
seconds
```
```
...
...
This diff is collapsed.
Click to expand it.
main.go
+
3
−
0
View file @
bce9cd9b
...
@@ -24,11 +24,14 @@ import (
...
@@ -24,11 +24,14 @@ import (
const
MaxKeySize
=
10240
const
MaxKeySize
=
10240
var
Version
string
// RootCmd represents the base command when called without any subcommands
// RootCmd represents the base command when called without any subcommands
var
RootCmd
=
&
cobra
.
Command
{
var
RootCmd
=
&
cobra
.
Command
{
Use
:
"nova-password <server-name>|<server-id> [<server-name>|<server-id>...]"
,
Use
:
"nova-password <server-name>|<server-id> [<server-name>|<server-id>...]"
,
Short
:
"Get the admin password for an OpenStack server"
,
Short
:
"Get the admin password for an OpenStack server"
,
SilenceUsage
:
true
,
SilenceUsage
:
true
,
Version
:
Version
,
PreRunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
PreRunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
len
(
args
)
==
0
{
if
len
(
args
)
==
0
{
cmd
.
Usage
()
cmd
.
Usage
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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