-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Idea] [Breaking changes!] Add shorthand flags #171
Changes from 5 commits
a66f6a7
3e340d7
6e8eaa1
fdbfe3c
4f776dd
a18db07
58dad03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
Copyright 2016 The Doctl Authors All rights reserved. | ||
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 doctl | ||
|
||
const ( | ||
/** | ||
// ArgActionID is an action id argument. | ||
ArgActionID = "action-id" | ||
// ArgActionAfter is an action after argument. | ||
ArgActionAfter = "after" | ||
// ArgActionBefore is an action before argument. | ||
ArgActionBefore = "before" | ||
// ArgActionResourceType is an action resource type argument. | ||
ArgActionResourceType = "resource-type" | ||
// ArgActionRegion is an action region argument. | ||
ArgActionRegion = "region" | ||
// ArgActionStatus is an action status argument. | ||
ArgActionStatus = "status" | ||
// ArgActionType is an action type argument. | ||
ArgActionType = "action-type" | ||
// ArgCommandWait is a wait for a droplet to be created argument. | ||
ArgCommandWait = "wait" | ||
// ArgDomainName is a domain name argument. | ||
ArgDomainName = "domain-name" | ||
// ArgDropletID is a droplet id argument. | ||
ArgDropletID = "droplet-id" | ||
// ArgKernelID is a ekrnel id argument. | ||
ArgKernelID = "kernel-id" | ||
// ArgImage is an image argument. | ||
ArgImage = "image" | ||
// ArgImageID is an image id argument. | ||
ArgImageID = "image-id" | ||
// ArgImagePublic is a public image argument. | ||
ArgImagePublic = "public" | ||
// ArgImageSlug is an image slug argment. | ||
ArgImageSlug = "image-slug" | ||
// ArgIPAddress is an IP address argument. | ||
ArgIPAddress = "ip-address" | ||
// ArgDropletName is a droplet name argument. | ||
ArgDropletName = "droplet-name" | ||
// ArgResizeDisk is a resize disk argument. | ||
ArgResizeDisk = "resize-disk" | ||
// ArgSnapshotName is a snapshot name arugment. | ||
ArgSnapshotName = "snapshot-name" | ||
// ArgBackups is an enable backups argument. | ||
ArgBackups = "enable-backups" | ||
// ArgIPv6 is an enable IPv6 argument. | ||
ArgIPv6 = "enable-ipv6" | ||
// ArgPrivateNetworking is an enable private networking argument. | ||
ArgPrivateNetworking = "enable-private-networking" | ||
// ArgRecordData is a record data argument. | ||
ArgRecordData = "record-data" | ||
// ArgRecordID is a record id argument. | ||
ArgRecordID = "record-id" | ||
// ArgRecordName is a record name argument. | ||
ArgRecordName = "record-name" | ||
// ArgRecordPort is a record port argument. | ||
ArgRecordPort = "record-port" | ||
// ArgRecordPriority is a record priority argument. | ||
ArgRecordPriority = "record-priority" | ||
// ArgRecordType is a record type argument. | ||
ArgRecordType = "record-type" | ||
// ArgRecordWeight is a record weight argument. | ||
ArgRecordWeight = "record-weight" | ||
// ArgRegionSlug is a region slug argument. | ||
ArgRegionSlug = "region" | ||
// ArgSizeSlug is a size slug argument. | ||
ArgSizeSlug = "size" | ||
// ArgsSSHKeyPath is a ssh argument. | ||
ArgsSSHKeyPath = "ssh-key-path" | ||
// ArgSSHKeys is a ssh key argument. | ||
ArgSSHKeys = "ssh-keys" | ||
// ArgsSSHPort is a ssh argument. | ||
ArgsSSHPort = "ssh-port" | ||
// ArgsSSHAgentForwarding is a ssh argument. | ||
ArgsSSHAgentForwarding = "ssh-agent-forwarding" | ||
// ArgsSSHPrivateIP is a ssh argument. | ||
ArgsSSHPrivateIP = "ssh-private-ip" | ||
// ArgUserData is a user data argument. | ||
ArgUserData = "user-data" | ||
// ArgUserDataFile is a user data file location argument. | ||
ArgUserDataFile = "user-data-file" | ||
// ArgImageName name is an image name argument. | ||
ArgImageName = "image-name" | ||
// ArgKey is a key argument. | ||
ArgKey = "key" | ||
// ArgKeyName is a key name argument. | ||
ArgKeyName = "key-name" | ||
// ArgKeyPublicKey is a public key argument. | ||
ArgKeyPublicKey = "public-key" | ||
// ArgKeyPublicKeyFile is a public key file argument. | ||
ArgKeyPublicKeyFile = "public-key-file" | ||
// ArgSSHUser is a SSH user argument. | ||
ArgSSHUser = "ssh-user" | ||
// ArgFormat is columns to include in output argment. | ||
ArgFormat = "format" | ||
// ArgNoHeader hides the output header. | ||
ArgNoHeader = "no-header" | ||
// ArgPollTime is how long before the next poll argument. | ||
ArgPollTime = "poll-timeout" | ||
// ArgTagName is a tag name | ||
ArgTagName = "tag-name" | ||
// ArgTagNames is a slice of possible tag names | ||
ArgTagNames = "tag-names" | ||
//ArgTemplate is template format | ||
ArgTemplate = "template" | ||
|
||
// ArgOutput is an output type argument. | ||
ArgOutput = "output" | ||
|
||
// ArgVolumeSize is the size of a volume. | ||
ArgVolumeSize = "size" | ||
// ArgVolumeDesc is the description of a volume. | ||
ArgVolumeDesc = "desc" | ||
// ArgVolumeRegion is the region of a volume. | ||
ArgVolumeRegion = "region" | ||
// ArgVolumeList is the IDs of many volumes. | ||
ArgVolumeList = "volumes" | ||
*/ | ||
// ArgDeleteForce forces deletion actions | ||
ArgShortDeleteForce = "f" | ||
|
||
// ArgResourceType is the resource type for snapshot. | ||
//ArgShortResourceType = "resource" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,8 @@ func Domain() *Command { | |
|
||
cmdDomainCreate := CmdBuilder(cmd, RunDomainCreate, "create <domain>", "create domain", Writer, | ||
aliasOpt("c"), displayerType(&domain{}), docCategories("domain")) | ||
AddStringFlag(cmdDomainCreate, doctl.ArgIPAddress, "", "IP address", requiredOpt()) | ||
|
||
AddStringFlag(cmdDomainCreate, doctl.ArgIPAddress, "", "", "IP address", requiredOpt()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiny nitpick, extra whitespace. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nanzhong fixed. :D I hope it's correct now. Also fixed indentation for |
||
CmdBuilder(cmd, RunDomainList, "list", "list domains", Writer, | ||
aliasOpt("ls"), displayerType(&domain{}), docCategories("domain")) | ||
|
||
|
@@ -59,29 +59,29 @@ func Domain() *Command { | |
|
||
cmdRecordList := CmdBuilder(cmdRecord, RunRecordList, "list <domain>", "list records", Writer, | ||
aliasOpt("ls"), displayerType(&domainRecord{}), docCategories("domain")) | ||
AddStringFlag(cmdRecordList, doctl.ArgDomainName, "", "Domain name") | ||
AddStringFlag(cmdRecordList, doctl.ArgDomainName, "", "", "Domain name") | ||
|
||
cmdRecordCreate := CmdBuilder(cmdRecord, RunRecordCreate, "create <domain>", "create record", Writer, | ||
aliasOpt("c"), displayerType(&domainRecord{}), docCategories("domain")) | ||
AddStringFlag(cmdRecordCreate, doctl.ArgRecordType, "", "Record type") | ||
AddStringFlag(cmdRecordCreate, doctl.ArgRecordName, "", "Record name") | ||
AddStringFlag(cmdRecordCreate, doctl.ArgRecordData, "", "Record data") | ||
AddIntFlag(cmdRecordCreate, doctl.ArgRecordPriority, 0, "Record priority") | ||
AddIntFlag(cmdRecordCreate, doctl.ArgRecordPort, 0, "Record port") | ||
AddIntFlag(cmdRecordCreate, doctl.ArgRecordWeight, 0, "Record weight") | ||
AddStringFlag(cmdRecordCreate, doctl.ArgRecordType, "", "", "Record type") | ||
AddStringFlag(cmdRecordCreate, doctl.ArgRecordName, "", "", "Record name") | ||
AddStringFlag(cmdRecordCreate, doctl.ArgRecordData, "", "", "Record data") | ||
AddIntFlag(cmdRecordCreate, doctl.ArgRecordPriority, "", 0, "Record priority") | ||
AddIntFlag(cmdRecordCreate, doctl.ArgRecordPort, "", 0, "Record port") | ||
AddIntFlag(cmdRecordCreate, doctl.ArgRecordWeight, "", 0, "Record weight") | ||
|
||
CmdBuilder(cmdRecord, RunRecordDelete, "delete <domain> <record id...>", "delete record", Writer, | ||
aliasOpt("d"), docCategories("domain")) | ||
|
||
cmdRecordUpdate := CmdBuilder(cmdRecord, RunRecordUpdate, "update <domain>", "update record", Writer, | ||
aliasOpt("u"), displayerType(&domainRecord{}), docCategories("domain")) | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordID, 0, "Record ID") | ||
AddStringFlag(cmdRecordUpdate, doctl.ArgRecordType, "", "Record type") | ||
AddStringFlag(cmdRecordUpdate, doctl.ArgRecordName, "", "Record name") | ||
AddStringFlag(cmdRecordUpdate, doctl.ArgRecordData, "", "Record data") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPriority, 0, "Record priority") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPort, 0, "Record port") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordWeight, 0, "Record weight") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordID, "", 0, "Record ID") | ||
AddStringFlag(cmdRecordUpdate, doctl.ArgRecordType, "", "", "Record type") | ||
AddStringFlag(cmdRecordUpdate, doctl.ArgRecordName, "", "", "Record name") | ||
AddStringFlag(cmdRecordUpdate, doctl.ArgRecordData, "", "", "Record data") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPriority, "", 0, "Record priority") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPort, "", 0, "Record port") | ||
AddIntFlag(cmdRecordUpdate, doctl.ArgRecordWeight, "", 0, "Record weight") | ||
|
||
return cmd | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why this large block of commented out code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption was some placeholder in case we want to introduce more short flags for other things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nanzhong @aybabtme I left it for placeholder, but I removed it. For now I defined it for force action, but we can add more actions later.