Documentation ¶
Overview ¶
A set of utility functions to handle with user's github personal access token
The user's GitHub Personal Access Token could be stored in operating system keyring, environment var or claro's config file (default $HOME/.claro.env)
A set of utility functions to handle with GitHub REST API ¶
A set of utility functions to handle with git command
Index ¶
- func AddAndCommitGradeFile(filename, repositoryDir string, p *pterm.ProgressbarPrinter)
- func CheckExternalsCommands()
- func CloneRepositories(outputDir string, repositories []RepData) ([]string, []string)
- func CreateKey(password string, removeIfExist bool) error
- func DeletePasswordItem() error
- func GetAndSaveToken(save bool) string
- func GetPassword() (string, error)
- func PromptUser(message string, question string) bool
- func Pull(files []fs.DirEntry, directory string)
- func ReadTokenFromStdIn() string
- func SaveGHToken(ghToken string)
- func WriteConfigFile(key, value, returnMessage string)
- type Config
- type RepData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAndCommitGradeFile ¶
func AddAndCommitGradeFile(filename, repositoryDir string, p *pterm.ProgressbarPrinter)
To add and commit a grade file in a GitHub repository
func CheckExternalsCommands ¶
func CheckExternalsCommands()
func CloneRepositories ¶
To clone repositories from GitHub
func DeletePasswordItem ¶
func DeletePasswordItem() error
Delete user's github personal access token from operating system keyring
func GetAndSaveToken ¶
To get user's github personal access token
func GetPassword ¶
Get the user's github personal access token from operating system keyring
func ReadTokenFromStdIn ¶
func ReadTokenFromStdIn() string
Ask user about github personal access token
func SaveGHToken ¶
func SaveGHToken(ghToken string)
Try to save the github personal access token: (1) os keyring; (2) claro config file
func WriteConfigFile ¶
func WriteConfigFile(key, value, returnMessage string)
Write key/value in the config file
Types ¶
type Config ¶
type Config struct { CommitMessage string `mapstructure:"COMMIT_MESSAGE"` GradeFileName string `mapstructure:"GRADE_FILENAME"` GradeTitle string `mapstructure:"GRADE_TITLE"` GradeString string `mapstructure:"GRADE_STRING"` GHToken string `mapstructure:"GH_TOKEN"` }
Struct to store config file vars