-
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
Refactor: move usage string to the constant #3480
Open
alexandear
wants to merge
1
commit into
zyedidia:master
Choose a base branch
from
alexandear:refactor/move-usage-to-const
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,49 @@ import ( | |
"github.com/zyedidia/tcell/v2" | ||
) | ||
|
||
const usage = `Usage: micro [OPTIONS] [FILE]... | ||
-clean | ||
Cleans the configuration directory | ||
-config-dir dir | ||
Specify a custom location for the configuration directory | ||
[FILE]:LINE:COL (if the ` + "`parsecursor`" + ` option is enabled) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this makes it not so unquestionable whether the code actually becomes more readable? |
||
+LINE:COL | ||
Specify a line and column to start the cursor at when opening a buffer | ||
-options | ||
Show all option help | ||
-debug | ||
Enable debug mode (enables logging to ./log.txt) | ||
-profile | ||
Enable CPU profiling (writes profile info to ./micro.prof | ||
so it can be analyzed later with "go tool pprof micro.prof") | ||
-version | ||
Show the version number and information | ||
|
||
Micro's plugins can be managed at the command line with the following commands. | ||
-plugin install [PLUGIN]... | ||
Install plugin(s) | ||
-plugin remove [PLUGIN]... | ||
Remove plugin(s) | ||
-plugin update [PLUGIN]... | ||
Update plugin(s) (if no argument is given, updates all plugins) | ||
-plugin search [PLUGIN]... | ||
Search for a plugin | ||
-plugin list | ||
List installed plugins | ||
-plugin available | ||
List available plugins | ||
|
||
Micro's options can also be set via command line arguments for quick | ||
adjustments. For real configuration, please use the settings.json | ||
file (see 'help options'). | ||
|
||
-option value | ||
Set ` + "`option` to `value`" + ` for this session | ||
For example: ` + "`micro -syntax off file.c`" + ` | ||
|
||
Use ` + "`micro -options`" + ` to see the full list of configuration options | ||
` | ||
|
||
var ( | ||
// Command line flags | ||
flagVersion = flag.Bool("version", false, "Show the version number and information") | ||
|
@@ -46,45 +89,7 @@ var ( | |
) | ||
|
||
func InitFlags() { | ||
flag.Usage = func() { | ||
fmt.Println("Usage: micro [OPTIONS] [FILE]...") | ||
fmt.Println("-clean") | ||
fmt.Println(" \tCleans the configuration directory") | ||
fmt.Println("-config-dir dir") | ||
fmt.Println(" \tSpecify a custom location for the configuration directory") | ||
fmt.Println("[FILE]:LINE:COL (if the `parsecursor` option is enabled)") | ||
fmt.Println("+LINE:COL") | ||
fmt.Println(" \tSpecify a line and column to start the cursor at when opening a buffer") | ||
fmt.Println("-options") | ||
fmt.Println(" \tShow all option help") | ||
fmt.Println("-debug") | ||
fmt.Println(" \tEnable debug mode (enables logging to ./log.txt)") | ||
fmt.Println("-profile") | ||
fmt.Println(" \tEnable CPU profiling (writes profile info to ./micro.prof") | ||
fmt.Println(" \tso it can be analyzed later with \"go tool pprof micro.prof\")") | ||
fmt.Println("-version") | ||
fmt.Println(" \tShow the version number and information") | ||
|
||
fmt.Print("\nMicro's plugins can be managed at the command line with the following commands.\n") | ||
fmt.Println("-plugin install [PLUGIN]...") | ||
fmt.Println(" \tInstall plugin(s)") | ||
fmt.Println("-plugin remove [PLUGIN]...") | ||
fmt.Println(" \tRemove plugin(s)") | ||
fmt.Println("-plugin update [PLUGIN]...") | ||
fmt.Println(" \tUpdate plugin(s) (if no argument is given, updates all plugins)") | ||
fmt.Println("-plugin search [PLUGIN]...") | ||
fmt.Println(" \tSearch for a plugin") | ||
fmt.Println("-plugin list") | ||
fmt.Println(" \tList installed plugins") | ||
fmt.Println("-plugin available") | ||
fmt.Println(" \tList available plugins") | ||
|
||
fmt.Print("\nMicro's options can also be set via command line arguments for quick\nadjustments. For real configuration, please use the settings.json\nfile (see 'help options').\n\n") | ||
fmt.Println("-option value") | ||
fmt.Println(" \tSet `option` to `value` for this session") | ||
fmt.Println(" \tFor example: `micro -syntax off file.c`") | ||
fmt.Println("\nUse `micro -options` to see the full list of configuration options") | ||
} | ||
flag.Usage = func() { fmt.Print(usage) } | ||
|
||
optionFlags = make(map[string]*string) | ||
|
||
|
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.
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.
With
hltaberrors
enabled, the leading spaces here are highlighted as an error..Why do we even print both spaces and a tab (
" \t"
)? Can't we print just a tab, or just 8 spaces?