forked from cli/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Gh owner dev #12
Merged
Merged
Gh owner dev #12
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds a new `--select` flag to the `gh owner` command, allowing users to interactively select a default owner. This is useful when there are multiple organizations or users to choose from. The selected owner will be set as the default owner for future `gh owner` commands.
This commit adds a new `--unset` flag to the `gh owner` command, allowing users to unset the default owner. This is useful when the default owner needs to be removed or changed. The `--unset` flag removes the default owner setting, allowing the user to select a new default owner in future `gh owner` commands.
…ent or using flags This commit modifies the `gh owner` command to provide flexibility in specifying the owner. Users can now either supply the owner as an argument in the format `[ORGANIZATION | USER]` or use the `--list`, `--select`, or `--unset` flags. This enhancement allows users to easily manage and select the default owner for future `gh owner` commands.
This commit refactors the `listOrgs` function in the `http.go` file to improve performance. The function is renamed to `listAllOrgs` to better reflect its purpose. Additionally, a cached HTTP client is used to reduce the number of API requests made. This optimization will result in faster retrieval of organization data when calling the `gh owner` command.
This commit updates the `cachedClient` initialization in the `http.go` file to set the expiration time to one week (`time.Hour*24*7`). By extending the expiration time, we can reduce the frequency of API requests made by the `listAllOrgs` function, resulting in improved performance and faster retrieval of organization data when using the `gh owner` command.
…r repositories This commit adds a new function, GetRepoWithDefaultOwner, to the ghowner package. The function takes a gh.Config and a repository name as parameters. If the repository name does not contain a slash ("/"), it checks if a default owner is set using the GetDefaultOwner function. If a default owner is found, the function returns the repository name in the format "OWNER/REPO". Otherwise, it returns the repository name as is. This function provides a convenient way to handle default owners for repositories in the CLI.
This commit adds the `DefaultOwnerFunc` function to the `cmdutil.Factory` struct, allowing the retrieval of the default owner from the configuration. The function checks if the `gh-owner` option is set in the config and returns the value if it exists. This change enables the use of the default owner in various parts of the codebase.
This commit refactors the OwnerOptions struct in the owner.go file to include a DefaultOwner field. The DefaultOwner field is a function that retrieves the default owner from the configuration. This change enables the use of the default owner in various parts of the codebase, improving flexibility and maintainability.
This commit adds a DefaultOwner field to the DeleteOptions struct in the delete.go file. The DefaultOwner field is a function that retrieves the default owner from the configuration. This change enables the use of the default owner when deleting repositories, improving flexibility and convenience.
This commit adds the `ghowner` package to handle the default owner for repositories. It introduces the `DefaultOwnerFunc` function in the `cmdutil.Factory` struct to retrieve the default owner from the configuration. The package also includes the `GetRepoWithDefaultOwner` function, which handles the default owner for repositories by checking if a default owner is set and formatting the repository name accordingly. This change improves flexibility and convenience when working with repositories in the CLI.
This commit adds a DefaultOwner field to the EditOptions struct in the edit.go file. The DefaultOwner field is a function that retrieves the default owner from the configuration. This change enables the use of the default owner when editing repositories, improving flexibility and convenience.
…strings.ContainsRune This commit refactors the RepoToOwnerRepo function in the owner.go file to use the strings.Contains function instead of strings.ContainsRune. The strings.Contains function provides a more efficient and concise way to check if a string contains another string. This change improves code readability and performance.
This commit adds a DefaultOwner field to the SetDefaultOptions struct in the setdefault.go file. The DefaultOwner field is a function that retrieves the default owner from the configuration. This change enables the use of the default owner when setting the default repository, improving flexibility and convenience.
This commit refactors the unarchive command in the unarchive.go file to use the DefaultOwner field from the UnarchiveOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. This change enables the use of the default owner when unarchiving repositories, improving flexibility and convenience.
This commit refactors the EnableRepoOverride function in the repo_override.go file to use the ghowner.RepoToOwnerRepo function. By using this function, the default owner is retrieved from the configuration and formatted correctly for the repository override. This change improves code readability and ensures consistency with other parts of the codebase.
This commit refactors the NewCmdList function in the list.go file to use the DefaultOwner field from the ListOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. By using this field, the code ensures that the owner is set to the default value when no owner is provided as an argument. This change improves flexibility and convenience when listing repositories.
This commit refactors the archive command in the archive.go file to use the DefaultOwner field from the ArchiveOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. By using this field, the code ensures that the owner is set to the default value when no owner is provided as an argument. This change improves flexibility and convenience when archiving repositories.
This commit refactors the cloneRun function in the clone.go file to use the DefaultOwner field from the CloneOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. By using this field, the code ensures that the owner is set to the default value when no owner is provided as an argument. This change improves flexibility and convenience when cloning repositories.
This commit refactors the deleteRun function in the delete.go file to use the DefaultOwner field from the DeleteOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. By using this field, the code ensures that the owner is set to the default value when no owner is provided as an argument. This change improves flexibility and convenience when deleting repositories.
This commit refactors the forkRun function in the fork.go file to use the DefaultOwner field from the ForkOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. By using this field, the code ensures that the owner is set to the default value when no owner is provided as an argument. This change improves flexibility and convenience when forking repositories.
This commit refactors the viewRun function in the view.go file to use the DefaultOwner field from the ViewOptions struct. The DefaultOwner field is a function that retrieves the default owner from the configuration. By using this field, the code ensures that the owner is set to the default value when no owner is provided as an argument. This change improves flexibility and convenience when viewing repositories.
This commit updates the prompt message in the selectOwnerPrompt function of the owner.go file. The prompt now includes a note to press CTRL-C to exit the selection process. This change improves the user experience by providing clear instructions on how to exit the prompt if needed.
Add some examples of other commands
Merge trunk to gh-owner-dev
Merged into gh-cli-for-education/cli Now pending to ask the corresponding pull request to the gh-cli team |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a new command to set a default owner. With this command you'll be able to use REPO instead of OWNER/REPO if a default OWNER is set.