Skip to content
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

Add account command #15

Merged
merged 3 commits into from
Jul 26, 2017
Merged

Add account command #15

merged 3 commits into from
Jul 26, 2017

Conversation

waits
Copy link
Contributor

@waits waits commented May 30, 2016

The account command displays information about the current user's account.
Currently it displays the user's name, email, ID, account type, locale,
referral link, paired status, and team info (if applicable).

It also takes an optional account ID to look up instead of the current user. In this case it displays slightly less info than when displaying the current account (due to API restrictions).

It also displays the team name and member ID if applicable. I don't have a business account to test with, though, so please double-check that it works.

Examples:

$ dbxcli account
Logged in as Dylan Waits <dylan@waits.io>

Account Id:        [redacted]
Account Type:      pro
Locale:            en
Referral Link:     [redacted]
Profile Photo Url: [redacted]
Paired Account:    true
$ dbxcli account dbid:xxxx
Name:              Dylan Waits
Email:             dylan@waits.io
Is Teammate:       true
Profile Photo URL: [redacted]

waits added 2 commits May 29, 2016 22:35
The `account` command displays information about the current user's account.
Currently it displays the user's name, email, ID, account type, locale,
referral link, paired status, and team info (if applicable).
Add an optional argument to the `account` command which allows it to look up
other users by their account ID.
@diwakergupta
Copy link
Collaborator

@waits what was your primary motivation for this command? As in, how are you using it in practice?

@waits
Copy link
Contributor Author

waits commented Jun 2, 2016

@diwakergupta In order of potential usefulness (for myself, anyways, but hopefully for others as well):

  1. A method of determining who you're logged in as. Most tools that log in to an account show you your name / account identifier in some way. For CLI tools, it's usually an account/info/whoami command. This is crucial because people (including myself) may have multiple accounts (or a shared computer) and thus need to know which account they're about to upload files to. A natural extension of this would be a logout command, but I made an issue to discuss that.
  2. A method of getting your account details without having to open a web browser. For people that primarily use the command line this would be very convenient. Of these details referral_link is the one I'm most interested in, although the profile photo is also handy, and account type is nice to know. I'll admit the locale doesn't seem all that useful; I was just trying to be complete.
  3. (this is not a real justification) The second part of this command, looking up another user by their ID, was driven more by API completeness than a real use case. My thinking was "Dropbox included this in their API, so someone must find it useful". I wasn't sure from the readme if you were aiming for full API functionality or not. If you can't fathom any realistic use case I'm totally OK with dropping this part.

w := new(tabwriter.Writer)
w.Init(os.Stdout, 4, 8, 1, ' ', 0)

switch len(args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add the len validations for this as well, you could simplify this to

if len(args) == 0 {
...
} else {
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's cleaner. Added b75d1e3.

Validate the length of the `args` slice before accessing it. This allows
the later switch statement to be simplified into an if/else block.
@diwakergupta diwakergupta merged commit a3c047c into dropbox:master Jul 26, 2017
@diwakergupta
Copy link
Collaborator

Thanks @waits !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants