-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Alphabetize listings in CLI #2326
Conversation
Thanks for picking this up. FYI you might want to look at this PR which seems abandoned #1729 (it has some refinements that I think we'd like to have plus a test). |
@@ -310,7 +311,7 @@ var actionListCmd = &cobra.Command{ | |||
if actions, _, err = client.Actions.List(qualifiedName.entityName, options); err != nil { | |||
return actionListError(qualifiedName.entityName, options, err) | |||
} | |||
|
|||
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 suggest using a prehook that runs our scan code - this will save you from failed travis builds: https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines
@underwoodb-sd-ibm Do you have an Apache ICLA signed and can let me know your name to verify? It is part of our project processes/reqs. See https://cwiki.apache.org/confluence/display/OPENWHISK/OpenWhisk+Project+Wiki Looking at your Github profile, I see this is your first PR... it would be very helpful to make sure you update it to include your name and email (make sure they are public) for not only our project, but others as well. |
@csantanapr, please add me as a reviewer here as well. |
@dubeejw you can go ahead and do a review, go the "Files changed" tab and do the review. I can't add you as a reviewer |
tools/vagrant/README.md
Outdated
@@ -5,6 +5,7 @@ The following instructions were tested on Mac OS X El Capitan, Ubuntu 14.04.3 LT | |||
*Requirements* | |||
- Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (tested with version 5.1.22) | |||
- Install [Vagrant](https://www.vagrantup.com/downloads.html) (tested with version 1.9.5) | |||
- Install [Cygwin64 with ssh](https://www.cygwin.com) (tested with verstion 2.8.0) |
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.
What's this? Should be a separate PR.
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.
It was unintended. I made a new commit retracting this from the Readme file. Thanks!
Need tests, and maybe doc update if you added any new flags. |
@@ -24,6 +24,7 @@ import ( | |||
"io" | |||
"strings" | |||
|
|||
|
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.
Remove extra new line
@@ -310,7 +311,6 @@ var actionListCmd = &cobra.Command{ | |||
if actions, _, err = client.Actions.List(qualifiedName.entityName, options); err != nil { | |||
return actionListError(qualifiedName.entityName, options, err) | |||
} | |||
|
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.
Leave new line
@@ -22,6 +22,7 @@ import ( | |||
"fmt" | |||
"strings" | |||
|
|||
|
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.
Remove extra new line.
tools/cli/go-whisk/whisk/action.go
Outdated
@@ -22,25 +22,32 @@ import ( | |||
"errors" | |||
"net/url" | |||
"../wski18n" | |||
"strings" | |||
|
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.
Remove extra new lines.
tools/cli/go-whisk/whisk/action.go
Outdated
Name string `json:"name,omitempty"` | ||
Namespace string `json:"namespace,omitempty"` |
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.
Revert struct to original.
tools/cli/go-whisk/whisk/action.go
Outdated
Limits *Limits `json:"limits,omitempty"` | ||
Error string `json:"error,omitempty"` | ||
Code int `json:"code,omitempty"` | ||
Publish *bool `json:"publish,omitempty"` | ||
} | ||
|
||
|
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.
Remove extra new line.
tools/cli/go-whisk/whisk/action.go
Outdated
//Defines how actions should be sorted | ||
//Currently sorts, by default, by Alphabetical order | ||
func(a Action) Compare(s Sortable) bool{ | ||
as := s.(Action) |
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.
More descriptive variable names would be nice.
tools/cli/go-whisk/whisk/package.go
Outdated
@@ -22,6 +22,8 @@ import ( | |||
"net/url" | |||
"errors" | |||
"../wski18n" | |||
"strings" | |||
|
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.
Remove extra new line.
tools/cli/go-whisk/whisk/trigger.go
Outdated
@@ -22,6 +22,8 @@ import ( | |||
"errors" | |||
"net/url" | |||
"../wski18n" | |||
"strings" | |||
|
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.
Remove
7b46a68
to
df5ee80
Compare
|
bin/wskadmin
Outdated
@@ -1 +0,0 @@ | |||
../tools/admin/wskadmin |
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.
Please remove this change. You can use git stash
to prevent adding changes that we don't want to be added to a commit.
bin/wskdev
Outdated
@@ -1 +0,0 @@ | |||
../tools/build/redo |
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.
Please remove this change.
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.
Just some really nit-picky formatting issues.
docs/actions.md
Outdated
|
||
``` | ||
wsk action list [PACKAGE NAME] | ||
``` | ||
|
||
Side Note: Listing works the same way for actions as it does for [packages](./packages.md), [APIs](./apigateway.md), [triggers and rules](./triggers_rules.md). |
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.
Nit pick: For consistency, the docs currently use *Note:*
rather than Side Note:
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.
Thanks! Updating now :)
docs/apigateway.md
Outdated
``` | ||
|
||
Side Note: APIs will be sorted alphabetically by default, first by Base path, then by Path (relative path), then by Verb. If we need to sort alphabetically by Action name, we can add the `-n` or `--sort-action` flags to do so. |
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.
Again: *Note:*
rather than Side Note:
docs/triggers_rules.md
Outdated
@@ -56,7 +56,7 @@ As an example, create a trigger to send user location updates, and manually fire | |||
ok: created trigger locationUpdate | |||
``` | |||
|
|||
2. Check that you created the trigger by listing the set of triggers. | |||
2. Check that you created the trigger by listing the set of triggers. (Side note: triggers and rules will be listed alphabetically when using the `list` command.) |
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.
Side note:
=> Note:
Though, really, this note isn't needed really here as it's not relevant to the tutorial step.
tools/vagrant/README.md
Outdated
@@ -5,7 +5,7 @@ The following instructions were tested on Mac OS X El Capitan, Ubuntu 14.04.3 LT | |||
*Requirements* | |||
- Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (tested with version 5.1.22) | |||
- Install [Vagrant](https://www.vagrantup.com/downloads.html) (tested with version 1.9.5) | |||
|
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.
None of the changes in this file are needed, though I don't suppose tidying up whitespace hurts.
}, | ||
{ | ||
"id": "sort api list by action name first followed by base-path/rel-path/verb", | ||
"translation": "sort api list by action name first followed by base-path/rel-path/verb." |
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.
Capitalise API
.
return err == nil | ||
} | ||
|
||
var boldString = color.New(color.Bold).SprintFunc() | ||
|
||
type SortCmds []whisk.Sortable | ||
//Uses Go builtin sort to sort commands based on their compare methods |
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.
Add a space between the comment marker (//
) and the text.
@@ -298,41 +342,17 @@ func printSummary(collection interface{}) { | |||
case *whisk.Activation: | |||
} | |||
} | |||
//Used to print Action, Tigger, Package, and Rule lists |
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.
Add a space between the comment marker (//
) and the text.
} | ||
|
||
val original = wsk.pkg.list().stdout | ||
//Create list with action names in correct order |
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.
Add a space between the comment marker (//
) and the text throughout the file.
528a38c
to
751f458
Compare
docs/packages.md
Outdated
/whisk.system/alarms shared | ||
/whisk.system/cloudant shared | ||
/whisk.system/github shared | ||
/whisk.system/pushnotifications shared |
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.
Shared is not aligned properly in the doc when viewing it for pushnotifications and samples.
(action, name) => action.create(name, artifact = Some(file), expectedExitCode = SUCCESS_EXIT, web = Some("true")) | ||
} | ||
//Create apiexperimentals | ||
println("Create api-experimental: Base Path " + base2) |
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.
Delete.
operation = Some("get"), | ||
action = Some(actionName2) | ||
) | ||
println("Create api-experimental: Base Path " + base1) |
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.
Delete.
operation = Some("delete"), | ||
action = Some(actionName1) | ||
) | ||
println("Create api-experimental: Base Path " + base3) |
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.
Delete.
(action, name) => action.create(name, artifact = Some(file), expectedExitCode = SUCCESS_EXIT, web = Some("true")) | ||
} | ||
//Create api-experimentals | ||
println("Create api-experimental: Base Path " + base2) |
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.
Delete.
@@ -299,7 +299,7 @@ var apiDeleteCmd = &cobra.Command{ | |||
if err != nil { | |||
whisk.Debug(whisk.DbgError, "client.Apis.Delete(%#v, %#v) error: %s\n", apiDeleteReq, apiDeleteReqOptions, err) | |||
errMsg := wski18n.T("Unable to delete API: {{.err}}", map[string]interface{}{"err": err}) | |||
whiskErr := whisk.MakeWskError(errors.New(errMsg), whisk.EXITCODE_ERR_GENERAL, | |||
whiskErr := whisk.MakeWskErrorFromWskError(errors.New(errMsg), err, whisk.EXITCODE_ERR_GENERAL, |
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.
Is this your change or do we need to restore the original?
for i:=0; i<len(retApiArray.Apis); i++ { | ||
printFilteredListRow(retApiArray.Apis[i].ApiValue, (*whisk.ApiOptions)(apiGetReqOptions), maxActionNameSize, maxApiNameSize) | ||
sortFilteredRow = append(sortFilteredRow, printFilteredListRow(retApiArray.Apis[i].ApiValue, (*whisk.ApiOptions)(apiGetReqOptions), maxActionNameSize, maxApiNameSize,flagType)...) |
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.
Indentation is off.
tools/cli/go-whisk/whisk/api.go
Outdated
|
||
// Check for flag to build proper comparison strings | ||
switch api.Flag { | ||
case "a": |
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.
Make the a character a constant and use the const instead.
tools/cli/go-whisk/whisk/trigger.go
Outdated
|
||
return fmt.Sprintf("%-70s %s\n", fmt.Sprintf("/%s/%s", trigger.Namespace, | ||
trigger.Name), publishState) | ||
|
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.
Delete new line here.
|
||
//Checks for any sort flags being passed | ||
if flags.api.sortAction { | ||
flagType = "a" |
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.
Use named constant instead.
76c9018
to
c681e6f
Compare
6aa6f52
to
392d495
Compare
PG2 1732. |
PG approved. |
392d495
to
1aab93e
Compare
1df8acd
to
1209db6
Compare
Update on latest design: the description of functionality for this PR has been updated in the top comment, but in short: per discussions with @mdeuser, @dubeejw, and @csantanapr, sorting by latest updated time has been made default again, and sorting alphabetically is now done with the flag |
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.
small change requested - to move tests, add retries.
@@ -210,6 +210,35 @@ class WskBasicTests | |||
stderr should include regex (s"""Unable to get package '$name': The requested resource does not exist. \\(code \\d+\\)""") | |||
} | |||
|
|||
it should "return a list of alphabetized packages" in withAssetCleaner(wskprops) { |
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.
this test belongs in wsk basic uses tests, not the system
package.
@@ -210,6 +210,35 @@ class WskBasicTests | |||
stderr should include regex (s"""Unable to get package '$name': The requested resource does not exist. \\(code \\d+\\)""") | |||
} | |||
|
|||
it should "return a list of alphabetized packages" in withAssetCleaner(wskprops) { |
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.
same for subsequent tests - generally the system package is for health checks.
pkg.create(name) | ||
} | ||
} | ||
val original = wsk.pkg.list(nameSort = Some(true)).stdout |
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.
it may be prudent to wrap these checks with a retry
(here and elsewhere) since a list operation may take some time to converge.
docs/actions.md
Outdated
|
||
**Note**: The printed list is sorted alphabetically after it is received from the server. Other list flags such as `--limit` and `--skip` will be applied to the block of actions before they are received for sorting. To list actions in order by creation time, use the flag `--time`. | ||
|
||
As you write more actions, this list gets longer and it can be helpful to group related actions into [packages](./packages.md). To filter your list of actions to just the those within a specific package, you can use: |
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.
Drop the
from the those
.
docs/actions.md
Outdated
``` | ||
|
||
As you write more actions, this list gets longer and it can be helpful to group related actions into [packages](./packages.md). To filter your list of actions to just the those within a specific pacakge, you can use: | ||
Here, we see actions listed in order from most to least recently updated. For easier browsing, you can use the flag `--name-sort` or `-n` to sort a list alphabetically: |
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.
Would change sort a list alphabetically
to sort the list alphabetically
@@ -459,6 +480,27 @@ class WskBasicTests | |||
wsk.action.get(name).stdout should not include (""""code"""") | |||
} | |||
|
|||
it should "return a list of alphabetized actions" in withAssetCleaner(wskprops) { |
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.
Need a test that ensures a packaged action is in the anticipated list order.
@@ -55,7 +55,7 @@ var namespaceListCmd = &cobra.Command{ | |||
werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXITCODE_ERR_NETWORK, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE) | |||
return werr | |||
} | |||
printList(namespaces) | |||
printList(namespaces, false) // `-t` flag appliest to `namespace get`, not list, so must pass value false for printList here |
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.
Typo applies
.
func(namespace Namespace) ToHeaderString() string { | ||
var boldString = color.New(color.Bold).SprintFunc() | ||
|
||
return fmt.Sprintf("%s\n", boldString("namespaces")) |
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.
This package should not know how the consumers of it operate. Here you are making the header bold to satisfy the consumer in function printCommandsList()
.
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.
The above applies to all the ToHeaderString()
methods.
ec4c19e
to
702db53
Compare
@dubeejw - please confirm that the issue you raised with the ToHeaderString() functions have been addressed properly? Thanks |
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Made tests in ApiGwTests & WskBasicUsageTests - Update to WskRuleTests - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
702db53
to
84149f4
Compare
Update: added code to allow |
PG1 1939 - Passed |
Looks like this also resolves #2598 Just looked at the change history after talking to Brandon and can verify it will fix that issue as well. |
val regex = s"${actionName}[1-3]".r | ||
// Retrieve action names into list as found in original | ||
val list = (regex.findAllMatchIn(original)).toList | ||
scalaSorted.toString shouldEqual list.toString |
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 guessing .toString
here isn't necessary.
is it?
applies in multiple places.
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
- Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
Alphabetize, coauthored by myself and @bpoole16, is intended to allow the user to sort a given list of entities alphabetically. This applies to actions, triggers, rules, packages, and apis.
By default, entities are listed in order from most to least recently updated:
To see the list of entities sorted alphabetically, use the flag
--name-sort
or-n
:The entities are sorted by namespace first, then package name (with the default package actions at the top), and finally by entity name.
Side effects of this PR
commands/util.go
Printables
: structures that are printed in lists on a regular basis.Sortables
: structures that are meant to be sorted.Potential upgrades from this branch:
--name-sort
is not applicable to activations; however, there may be another way of sorting activations which would be beneficial. The ability to sort activations is set up, one only needs to set the function Compare() inwhisk/activation.go
and make a custom flag to activate the sorting for it to be implemented.Action name -> Base path -> Rel path -> Verb
for APIs