-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rename variable * only set mimeType to folder if empty * update deps * add setting for MaxElapsedTime * remove old entries * update deps * update ci * update version * switch to universal binaries for mac * update deps * add commands to get the current default scopes and reset to current scopes to the defaults
- Loading branch information
1 parent
c672f6b
commit 7db1755
Showing
13 changed files
with
226 additions
and
118 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,3 @@ gsm.log | |
.vscode/settings.json | ||
*.csv | ||
*.ps1 | ||
gsmchat/ | ||
cmd/chat* |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright © 2020-2023 Hannes Hayashi | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hanneshayashi/gsm/gsmconfig" | ||
"github.com/hanneshayashi/gsm/gsmhelpers" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// configsGetDefaultScopesCmd represents the getDefaultScopes command | ||
var configsGetDefaultScopesCmd = &cobra.Command{ | ||
Use: "getDefaultScopes", | ||
Short: "Returns the default scopes.", | ||
Long: `The default scopes may change with every GSM version as new APIs are added. | ||
Use this command to see the current defaults. | ||
Use "gsm configs resetScopes" to set the current default.`, | ||
Annotations: map[string]string{ | ||
"crescendoOutput": "$args[0]", | ||
}, | ||
DisableAutoGenTag: true, | ||
Run: func(_ *cobra.Command, _ []string) { | ||
result := gsmconfig.GetDefaultScopes() | ||
fmt.Println(strings.Join(result, ",")) | ||
}, | ||
} | ||
|
||
func init() { | ||
gsmhelpers.InitCommand(configsCmd, configsGetDefaultScopesCmd, configFlags) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright © 2020-2023 Hannes Hayashi | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"strings" | ||
|
||
"github.com/hanneshayashi/gsm/gsmconfig" | ||
"github.com/hanneshayashi/gsm/gsmhelpers" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// configsResetScopesCmd represents the resetScopes command | ||
var configsResetScopesCmd = &cobra.Command{ | ||
Use: "resetScopes", | ||
Short: "Resets the scopes of a config back to the defaults.", | ||
Long: fmt.Sprintf(`Sets the the scopes of the specified config or the default config if not specified back to the defaults: | ||
%s`, strings.Join(gsmconfig.GetDefaultScopes(), ",\n")), | ||
Annotations: map[string]string{ | ||
"crescendoOutput": "$args[0]", | ||
}, | ||
DisableAutoGenTag: true, | ||
Run: func(_ *cobra.Command, _ []string) { | ||
result, err := gsmconfig.UpdateConfig(&gsmconfig.GSMConfig{ | ||
Scopes: gsmconfig.GetDefaultScopes(), | ||
}, cfgFile) | ||
if err != nil { | ||
fmt.Printf("Error resetting scopes: %v\n", err) | ||
return | ||
} | ||
err = gsmhelpers.Output(result, "yaml", false) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
gsmhelpers.InitCommand(configsCmd, configsResetScopesCmd, configFlags) | ||
} |
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 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 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
Oops, something went wrong.