Skip to content

Commit 3c9bfb1

Browse files
Improve autocompletion
Move autocompletion code to a new shell file. In .bash_profile, .bashrc and .zshrc add code that executes this code when we want to enable autocompletion. Autocomplete is now hierarchical command. The subcommands and their behavior is: * `autocomplete` - checks if autocompletion is enabled. In case it is not, ask the user for confirmation. In case autocompletion is enabled, but it is the old one (where we've written some data to .bash_profile, etc.), silently remove the old code and use the new approach. In case the user chooses to not use autocompletion, call disableAutocCompletion in order to remove all autocompletion code from all shell profiles. * `autocomplete enable` - enables autocompletion in case it is not already enabled. * `autocomplete disable` - disables autocompletion in case it is not already disabled. * `autocomplete status` - prints the current status of autocompletion. Add help for autocomplete commands.
1 parent 61c0859 commit 3c9bfb1

File tree

5 files changed

+80
-5
lines changed

5 files changed

+80
-5
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
autocomplete disable
2+
==========
3+
4+
Usage | Syntax
5+
------|-------
6+
General | `$ tns autocomplete disable`
7+
8+
9+
Disables autocompletion for bash and zsh.
10+
11+
> NOTE: This will modify your .bash_profile, .bashrc and .zshrc files.
12+
13+
<% if(isHtml) { %>
14+
15+
#### Related Commands
16+
17+
Command | Description
18+
----------|----------
19+
[autocomplete-status](autocomplete-status.html) | Shows if autocompletion is enabled for bash and zsh.
20+
[autocomplete](autocomplete.html) | Asks for confirmation if command line autocompletion should be enabled for bash and zsh.
21+
[autocomplete-enable](autocomplete-enable.html) | Enables autocompletion for bash and zsh.
22+
[feature-usage-tracking](feature-usage-tracking.html) | Configures anonymous usage statistics tracking for the NativeScript command-line interface.
23+
[help](help.html) | Lists the available commands or shows information about the selected command.
24+
<% } %>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
autocomplete enable
2+
==========
3+
4+
Usage | Syntax
5+
------|-------
6+
General | `$ tns autocomplete enable`
7+
8+
9+
Enables autocompletion for bash and zsh.
10+
11+
> NOTE: This will modify your .bash_profile, .bashrc and .zshrc files.
12+
13+
<% if(isHtml) { %>
14+
15+
#### Related Commands
16+
17+
Command | Description
18+
----------|----------
19+
[feature-usage-tracking](feature-usage-tracking.html) | Configures anonymous usage statistics tracking for the NativeScript command-line interface.
20+
[help](help.html) | Lists the available commands or shows information about the selected command.
21+
<% } %>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
autocomplete status
2+
==========
3+
4+
Usage | Syntax
5+
------|-------
6+
General | `$ tns autocomplete status`
7+
8+
9+
Shows if autocompletion is enabled for bash and zsh.
10+
11+
<% if(isHtml) { %>
12+
13+
#### Related Commands
14+
15+
Command | Description
16+
----------|----------
17+
[autocomplete](autocomplete.html) | Asks for confirmation if command line autocompletion should be enabled for bash and zsh.
18+
[autocomplete-enable](autocomplete-enable.html) | Enables autocompletion for bash and zsh.
19+
[autocomplete-disable](autocomplete-disable.html) | Disables autocompletion for bash and zsh.
20+
[feature-usage-tracking](feature-usage-tracking.html) | Configures anonymous usage statistics tracking for the NativeScript command-line interface.
21+
[help](help.html) | Lists the available commands or shows information about the selected command.
22+
<% } %>
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
autocomplete
22
==========
33

4-
Turns on command line autocompletion for bash and zsh.
4+
Usage | Syntax
5+
------|-------
6+
General | `$ appbuilder autocomplete`
7+
Get status | `$ appbuilder autocomplete status`
8+
Enable | `$ appbuilder autocomplete enable`
9+
Disable | `$ appbuilder autocomplete disable`
510

6-
Usage:
7-
`$ tns autocomplete`
811

9-
> NOTE: this will modify your .bash_profile, .bashrc and .zshrc files.
12+
Asks for confirmation if command line autocompletion should be enabled for bash and zsh.
13+
14+
> NOTE: This will modify your .bash_profile, .bashrc and .zshrc files.
1015
<% if(isHtml) { %>
1116
1217
#### Related Commands
1318

1419
Command | Description
1520
----------|----------
21+
[autocomplete-status](autocomplete-status.html) | Shows if autocompletion is enabled for bash and zsh.
22+
[autocomplete-enable](autocomplete-enable.html) | Enables autocompletion for bash and zsh.
23+
[autocomplete-disable](autocomplete-disable.html) | Disables autocompletion for bash and zsh.
1624
[feature-usage-tracking](feature-usage-tracking.html) | Configures anonymous usage statistics tracking for the NativeScript command-line interface.
1725
[help](help.html) | Lists the available commands or shows information about the selected command.
1826
<% } %>

0 commit comments

Comments
 (0)