aia 0.0.5 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +24 -2
- data/lib/aia/aia_completion.bash +39 -0
- data/lib/aia/aia_completion.fish +34 -0
- data/lib/aia/aia_completion.zsh +39 -0
- data/lib/aia/cli.rb +45 -31
- data/lib/aia/configuration.rb +0 -5
- data/lib/aia/external/,keep +0 -0
- data/lib/aia/external/.irbrc +11 -0
- data/lib/aia/external/ag.rb +103 -0
- data/lib/aia/external/bat.rb +189 -0
- data/lib/aia/external/fzf.rb +147 -0
- data/lib/aia/external/glow.rb +37 -0
- data/lib/aia/external/mods.rb +57 -0
- data/lib/aia/external/rg.rb +1163 -0
- data/lib/aia/external/sgpt.rb +58 -0
- data/lib/aia/external/subl.rb +47 -0
- data/lib/aia/external/tool.rb +73 -0
- data/lib/aia/external.rb +259 -0
- data/lib/aia/external_two.rb +43 -0
- data/lib/aia/main.rb +2 -2
- data/lib/aia/prompt_processing.rb +67 -13
- data/lib/aia/version.rb +1 -1
- metadata +18 -5
- data/bin/aia_completion.sh +0 -37
- data/lib/aia/external_commands.rb +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2d934f517983c9854654eeb01d9b5ca6a08c92cb531b315a8b223e6e2ffd23
|
4
|
+
data.tar.gz: cd5ac0f18c2a290205c717c2d9e1e2e43ffe0a51f5aac400d3a1fce6137db4c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c859d26173c65d577cd9a49c4333f5c104d69b37205523a1f2249f284de38e1af06ec1870cea9774858e9688eb67639135fe2500b3550693f33ba621eada79
|
7
|
+
data.tar.gz: 808e69fc41eaba3396ebfb7157063e43709034a5009fcc06fb01c0055a2b371ef128962bea32a2cae8efc0e8ee0b8d8aeb5f4f180e5e4754176bfc70fecf17a0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.0] = 2023-11-23
|
4
|
+
|
5
|
+
- Matching version to [prompt_manager](https://github.com/prompt_manager) This version allows for the user of history in the entery of values to prompt keywords. KW_HISTORY_MAX is set at 5. Changed CLI enteraction to use historical selection and editing of prior keyword values.
|
6
|
+
|
3
7
|
## [0.1.0] - 2023-11-23
|
4
8
|
|
5
9
|
- Initial release
|
data/README.md
CHANGED
@@ -1,11 +1,27 @@
|
|
1
1
|
# AI Assistant (AIA)
|
2
2
|
|
3
|
-
**Under Development**
|
4
|
-
|
5
3
|
`aia` is a command-line utility that integrates prameterized prompt management with generative AI (gen-AI) execution.
|
6
4
|
|
7
5
|
Uses the gem "prompt_manager" to manage the prompts sent to the `mods` command-line utility. Uses the command line tools "ripgrep" to search for prompts to send and "fzf" to select the prompts that match the search term.
|
8
6
|
|
7
|
+
**Most Recent Change**
|
8
|
+
|
9
|
+
v0.3.0 - Matching version to [prompt_manager](https://github.com/prompt_manager) This version allows for the user of history in the entery of values to prompt keywords. KW_HISTORY_MAX is set at 5. Changed CLI enteraction to use historical selection and editing of prior keyword values.
|
10
|
+
|
11
|
+
|
12
|
+
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
|
+
|
14
|
+
## Table of Contents
|
15
|
+
|
16
|
+
- [Installation](#installation)
|
17
|
+
- [Usage](#usage)
|
18
|
+
- [System Environment Variables (envars)](#system-environment-variables-envars)
|
19
|
+
- [External CLI Tools Used](#external-cli-tools-used)
|
20
|
+
- [Development](#development)
|
21
|
+
- [Contributing](#contributing)
|
22
|
+
- [License](#license)
|
23
|
+
|
24
|
+
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
9
25
|
|
10
26
|
|
11
27
|
## Installation
|
@@ -138,6 +154,12 @@ export EDITOR="subl -w"
|
|
138
154
|
|
139
155
|
```
|
140
156
|
|
157
|
+
## Shell Completion
|
158
|
+
|
159
|
+
One of the executables with this gem is `aia_completion.sh` which contains a completion script for hte `aia` such that you specify the first few characters of a prompt ID on the command line and the shell will complete the rest of the ID for you. It works with the `bash` shell but do not know whether it works with the other shells.
|
160
|
+
|
161
|
+
To set the completion you can execute aia_completion.sh` in your `.bashrc` however, the PROMPTS_DIR environment variable must be set in order for prompt ID to work correctly.
|
162
|
+
|
141
163
|
|
142
164
|
## Development
|
143
165
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# lib/aia/aia_completion.bash
|
2
|
+
# Setup a prompt completion for use with
|
3
|
+
# the bash shell
|
4
|
+
#
|
5
|
+
# This script assumes that the system environment
|
6
|
+
# variable PROMPTS_DIR has been set correctly
|
7
|
+
|
8
|
+
_aia_completion() {
|
9
|
+
# The current word being completed
|
10
|
+
local cur_word="${COMP_WORDS[COMP_CWORD]}"
|
11
|
+
|
12
|
+
# The previous word before the current word
|
13
|
+
local prev_word="${COMP_WORDS[COMP_CWORD-1]}"
|
14
|
+
|
15
|
+
# Store the previous directory to return to it later
|
16
|
+
local initial_pwd=$(pwd)
|
17
|
+
|
18
|
+
# Check if we are currently completing the option that requires prompt IDs
|
19
|
+
if [[ "$prev_word" == "aia" ]]; then
|
20
|
+
# Change directory to the prompts directory
|
21
|
+
cd "$PROMPTS_DIR" || return
|
22
|
+
|
23
|
+
# Generate a list of relative paths from the ~/.prompts directory (without .txt extension)
|
24
|
+
local files=($(find . -name "*.txt" -type f | sed 's|^\./||' | sed 's/\.txt$//'))
|
25
|
+
|
26
|
+
# Change back to the initial directory
|
27
|
+
cd "$initial_pwd" || return
|
28
|
+
|
29
|
+
# Generate possible matches and store them in the COMPREPLY array
|
30
|
+
COMPREPLY=($(compgen -W "${files[*]}" -- "$cur_word"))
|
31
|
+
else
|
32
|
+
# If not the specific option, perform regular file completion
|
33
|
+
COMPREPLY=($(compgen -o default -- "$cur_word"))
|
34
|
+
fi
|
35
|
+
}
|
36
|
+
|
37
|
+
# Register the completion function for the aia command
|
38
|
+
complete -F _aia_completion aia
|
39
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# lib/aia/aia_completion.fish
|
2
|
+
# Setup a prompt completion for use with the fish shell
|
3
|
+
#
|
4
|
+
# This script assumes that the system environment
|
5
|
+
# variable PROMPTS_DIR has been set correctly
|
6
|
+
|
7
|
+
function __fish_aia_complete
|
8
|
+
# Get the command line and current token
|
9
|
+
set -l cmd_line (commandline -opc)
|
10
|
+
set -l current_token (commandline -ct)
|
11
|
+
|
12
|
+
# Check if we are currently completing the option that requires prompt IDs
|
13
|
+
if set -q cmd_line[2]
|
14
|
+
# Change directory to the prompts directory
|
15
|
+
if test -d $PROMPTS_DIR
|
16
|
+
pushd $PROMPTS_DIR
|
17
|
+
# Generate completions based on .txt files in the PROMPTS_DIR directory
|
18
|
+
for file in (find . -name "*.txt" -type f)
|
19
|
+
set file (string replace -r '\.txt$' '' -- $file)
|
20
|
+
set file (string replace -r '^\./' '' -- $file)
|
21
|
+
printf "%s\n" $file
|
22
|
+
end
|
23
|
+
popd
|
24
|
+
end
|
25
|
+
else
|
26
|
+
# Use the default file completion if we are not completing a prompt ID
|
27
|
+
complete -f -c aia -a "(commandline -ct)"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Register the completion function for the aia command
|
32
|
+
complete -c aia -a '(__fish_aia_complete)' -f
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# lib/aia/aia_completion.zsh
|
2
|
+
# Setup a prompt completion for use with
|
3
|
+
# the zsh shell
|
4
|
+
#
|
5
|
+
# This script assumes that the system environment
|
6
|
+
# variable PROMPTS_DIR has been set correctly
|
7
|
+
|
8
|
+
_aia_completion() {
|
9
|
+
# The current word being completed
|
10
|
+
local cur_word="$words[$CURRENT]"
|
11
|
+
|
12
|
+
# The previous word before the current word
|
13
|
+
local prev_word="$words[$CURRENT-1]"
|
14
|
+
|
15
|
+
# Store the previous directory to return to it later
|
16
|
+
local initial_pwd=$PWD
|
17
|
+
|
18
|
+
# Check if we are currently completing the option that requires prompt IDs
|
19
|
+
if [[ "$prev_word" == "aia" ]]; then
|
20
|
+
# Change directory to the prompts directory
|
21
|
+
cd "$PROMPTS_DIR" || return
|
22
|
+
|
23
|
+
# Generate a list of relative paths from the ~/.prompts directory (without .txt extension)
|
24
|
+
local files=($(find . -name "*.txt" -type f | sed 's|^\./||' | sed 's/\.txt$//'))
|
25
|
+
|
26
|
+
# Change back to the initial directory
|
27
|
+
cd "$initial_pwd" || return
|
28
|
+
|
29
|
+
# Generate possible matches and store them in an array
|
30
|
+
_describe 'prompt ID' files
|
31
|
+
else
|
32
|
+
# If not the specific option, use the standard filename completion
|
33
|
+
_files
|
34
|
+
fi
|
35
|
+
}
|
36
|
+
|
37
|
+
# Register the completion function for the aia command using compctl
|
38
|
+
compctl -K _aia_completion aia
|
39
|
+
|
data/lib/aia/cli.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module AIA::Cli
|
4
4
|
def setup_cli_options(args)
|
5
5
|
@arguments = args
|
6
|
+
# TODO: consider a fixed config file: ~/,aia
|
6
7
|
@options = {
|
7
8
|
# Value
|
8
9
|
edit?: [false, "-e --edit", "Edit the Prompt File"],
|
@@ -11,11 +12,13 @@ module AIA::Cli
|
|
11
12
|
version?: [false, "--version", "Print Version"],
|
12
13
|
help?: [false, "-h --help", "Show Usage"],
|
13
14
|
fuzzy?: [false, "--fuzzy", "Use Fuzzy Matching"],
|
15
|
+
completion: [nil, "--completion", "Show completion script for bash|zsh|fish"],
|
14
16
|
# TODO: Consider dropping output in favor of always
|
15
17
|
# going to STDOUT so user can redirect or pipe somewhere else
|
16
18
|
output: [OUTPUT,"-o --output --no-output", "Out FILENAME"],
|
17
19
|
log: [PROMPT_LOG,"-l --log --no-log", "Log FILEPATH"],
|
18
20
|
markdown?: [true, "-m --markdown --no-markdown --md --no-md", "Format with Markdown"],
|
21
|
+
backend: [:mods, "-b --be --backend --no-backend", "Specify the backend prompt resolver"],
|
19
22
|
}
|
20
23
|
|
21
24
|
# Array(String)
|
@@ -30,8 +33,9 @@ module AIA::Cli
|
|
30
33
|
usage = "\n#{MY_NAME} v#{AIA::VERSION}\n\n"
|
31
34
|
usage += "Usage: #{MY_NAME} [options] prompt_id [context_file]* [-- external_options+]\n\n"
|
32
35
|
usage += usage_options
|
33
|
-
usage +=
|
34
|
-
usage +=
|
36
|
+
usage += usage_options_details
|
37
|
+
usage += "\n"
|
38
|
+
usage += usage_notes if verbose?
|
35
39
|
|
36
40
|
usage
|
37
41
|
end
|
@@ -61,10 +65,30 @@ module AIA::Cli
|
|
61
65
|
end
|
62
66
|
|
63
67
|
|
68
|
+
def usage_options_details
|
69
|
+
<<~EOS
|
70
|
+
|
71
|
+
Details
|
72
|
+
-------
|
73
|
+
|
74
|
+
Use (--help --verbose) or (-h -v) for verbose usage text.
|
75
|
+
|
76
|
+
Use --completion bash|zsh|fish to show a script
|
77
|
+
that will add prompt ID completion to your desired shell.
|
78
|
+
You must copy the output from this option into a
|
79
|
+
place where the function will be executed for
|
80
|
+
your shell.
|
81
|
+
|
82
|
+
EOS
|
83
|
+
end
|
84
|
+
|
85
|
+
|
64
86
|
def usage_notes
|
65
87
|
<<~EOS
|
88
|
+
|
66
89
|
#{usage_envars}
|
67
|
-
#{AIA::
|
90
|
+
#{AIA::External::HELP}
|
91
|
+
|
68
92
|
EOS
|
69
93
|
end
|
70
94
|
|
@@ -115,6 +139,8 @@ module AIA::Cli
|
|
115
139
|
check_for option
|
116
140
|
end
|
117
141
|
|
142
|
+
show_completion unless @options[:completion].nil?
|
143
|
+
|
118
144
|
# get the options meant for the backend AI command
|
119
145
|
extract_extra_options
|
120
146
|
|
@@ -161,7 +187,6 @@ module AIA::Cli
|
|
161
187
|
end
|
162
188
|
|
163
189
|
|
164
|
-
|
165
190
|
def show_usage
|
166
191
|
@options[:help?][0] = false
|
167
192
|
puts usage
|
@@ -170,40 +195,29 @@ module AIA::Cli
|
|
170
195
|
alias_method :show_help, :show_usage
|
171
196
|
|
172
197
|
|
173
|
-
def
|
174
|
-
|
175
|
-
|
176
|
-
end
|
177
|
-
end
|
198
|
+
def show_completion
|
199
|
+
shell = @options[:completion].first
|
200
|
+
script = Pathname.new(__dir__) + "aia_completion.#{shell}"
|
178
201
|
|
202
|
+
if script.exist?
|
203
|
+
puts
|
204
|
+
puts script.read
|
205
|
+
puts
|
206
|
+
else
|
207
|
+
STDERR.puts <<~EOS
|
179
208
|
|
180
|
-
|
209
|
+
ERRORL The shell '#{shell}' is not supported.
|
181
210
|
|
211
|
+
EOS
|
212
|
+
end
|
182
213
|
|
183
|
-
# TODO: Consider using this history process to preload the default
|
184
|
-
# so that an up arrow will bring the previous answer into
|
185
|
-
# the read buffer for line editing.
|
186
|
-
# Instead of usin the .history file just push the default
|
187
|
-
# value from the JSON file.
|
188
214
|
|
189
|
-
|
190
|
-
# Skip empty entries and duplicates
|
191
|
-
if input.empty? || Readline::HISTORY.to_a[-2] == input
|
192
|
-
Readline::HISTORY.pop
|
215
|
+
exit
|
193
216
|
end
|
194
|
-
break if input == 'exit'
|
195
217
|
|
196
|
-
# Do something with the input
|
197
|
-
puts "You entered: #{input}"
|
198
218
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
# Load history from file at the beginning of the program
|
204
|
-
if File.exist?('.history')
|
205
|
-
File.readlines('.history').each do |line|
|
206
|
-
Readline::HISTORY.push(line.chomp)
|
219
|
+
def show_version
|
220
|
+
puts AIA::VERSION
|
221
|
+
exit
|
207
222
|
end
|
208
223
|
end
|
209
|
-
|
data/lib/aia/configuration.rb
CHANGED
File without changes
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# lib/aia/external/ag.rb
|
2
|
+
|
3
|
+
class AIA::External::Ag < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :search
|
7
|
+
@desc = "the_silver_searcher Code-search similar to ack"
|
8
|
+
@url = "https://github.com/ggreer/the_silver_searcher"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
__END__
|
13
|
+
|
14
|
+
Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]
|
15
|
+
|
16
|
+
Recursively search for PATTERN in PATH.
|
17
|
+
Like grep or ack, but faster.
|
18
|
+
|
19
|
+
Example:
|
20
|
+
ag -i foo /bar/
|
21
|
+
|
22
|
+
Output Options:
|
23
|
+
--ackmate Print results in AckMate-parseable format
|
24
|
+
-A --after [LINES] Print lines after match (Default: 2)
|
25
|
+
-B --before [LINES] Print lines before match (Default: 2)
|
26
|
+
--[no]break Print newlines between matches in different files
|
27
|
+
(Enabled by default)
|
28
|
+
-c --count Only print the number of matches in each file.
|
29
|
+
(This often differs from the number of matching lines)
|
30
|
+
--[no]color Print color codes in results (Enabled by default)
|
31
|
+
--color-line-number Color codes for line numbers (Default: 1;33)
|
32
|
+
--color-match Color codes for result match numbers (Default: 30;43)
|
33
|
+
--color-path Color codes for path names (Default: 1;32)
|
34
|
+
--column Print column numbers in results
|
35
|
+
--[no]filename Print file names (Enabled unless searching a single file)
|
36
|
+
-H --[no]heading Print file names before each file's matches
|
37
|
+
(Enabled by default)
|
38
|
+
-C --context [LINES] Print lines before and after matches (Default: 2)
|
39
|
+
--[no]group Same as --[no]break --[no]heading
|
40
|
+
-g --filename-pattern PATTERN
|
41
|
+
Print filenames matching PATTERN
|
42
|
+
-l --files-with-matches Only print filenames that contain matches
|
43
|
+
(don't print the matching lines)
|
44
|
+
-L --files-without-matches
|
45
|
+
Only print filenames that don't contain matches
|
46
|
+
--print-all-files Print headings for all files searched, even those that
|
47
|
+
don't contain matches
|
48
|
+
--[no]numbers Print line numbers. Default is to omit line numbers
|
49
|
+
when searching streams
|
50
|
+
-o --only-matching Prints only the matching part of the lines
|
51
|
+
--print-long-lines Print matches on very long lines (Default: >2k characters)
|
52
|
+
--passthrough When searching a stream, print all lines even if they
|
53
|
+
don't match
|
54
|
+
--silent Suppress all log messages, including errors
|
55
|
+
--stats Print stats (files scanned, time taken, etc.)
|
56
|
+
--stats-only Print stats and nothing else.
|
57
|
+
(Same as --count when searching a single file)
|
58
|
+
--vimgrep Print results like vim's :vimgrep /pattern/g would
|
59
|
+
(it reports every match on the line)
|
60
|
+
-0 --null --print0 Separate filenames with null (for 'xargs -0')
|
61
|
+
|
62
|
+
Search Options:
|
63
|
+
-a --all-types Search all files (doesn't include hidden files
|
64
|
+
or patterns from ignore files)
|
65
|
+
-D --debug Ridiculous debugging (probably not useful)
|
66
|
+
--depth NUM Search up to NUM directories deep (Default: 25)
|
67
|
+
-f --follow Follow symlinks
|
68
|
+
-F --fixed-strings Alias for --literal for compatibility with grep
|
69
|
+
-G --file-search-regex PATTERN Limit search to filenames matching PATTERN
|
70
|
+
--hidden Search hidden files (obeys .*ignore files)
|
71
|
+
-i --ignore-case Match case insensitively
|
72
|
+
--ignore PATTERN Ignore files/directories matching PATTERN
|
73
|
+
(literal file/directory names also allowed)
|
74
|
+
--ignore-dir NAME Alias for --ignore for compatibility with ack.
|
75
|
+
-m --max-count NUM Skip the rest of a file after NUM matches (Default: 10,000)
|
76
|
+
--one-device Don't follow links to other devices.
|
77
|
+
-p --path-to-ignore STRING
|
78
|
+
Use .ignore file at STRING
|
79
|
+
-Q --literal Don't parse PATTERN as a regular expression
|
80
|
+
-s --case-sensitive Match case sensitively
|
81
|
+
-S --smart-case Match case insensitively unless PATTERN contains
|
82
|
+
uppercase characters (Enabled by default)
|
83
|
+
--search-binary Search binary files for matches
|
84
|
+
-t --all-text Search all text files (doesn't include hidden files)
|
85
|
+
-u --unrestricted Search all files (ignore .ignore, .gitignore, etc.;
|
86
|
+
searches binary and hidden files as well)
|
87
|
+
-U --skip-vcs-ignores Ignore VCS ignore files
|
88
|
+
(.gitignore, .hgignore; still obey .ignore)
|
89
|
+
-v --invert-match
|
90
|
+
-w --word-regexp Only match whole words
|
91
|
+
-W --width NUM Truncate match lines after NUM characters
|
92
|
+
-z --search-zip Search contents of compressed (e.g., gzip) files
|
93
|
+
|
94
|
+
File Types:
|
95
|
+
The search can be restricted to certain types of files. Example:
|
96
|
+
ag --html needle
|
97
|
+
- Searches for 'needle' in files with suffix .htm, .html, .shtml or .xhtml.
|
98
|
+
|
99
|
+
For a list of supported file types run:
|
100
|
+
ag --list-file-types
|
101
|
+
|
102
|
+
ag was originally created by Geoff Greer. More information (and the latest release)
|
103
|
+
can be found at http://geoff.greer.fm/ag
|
@@ -0,0 +1,189 @@
|
|
1
|
+
# lib/aia/external/bat.rb
|
2
|
+
|
3
|
+
class AIA::External::Bat < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :render
|
7
|
+
@desc = 'Clone of cat(1) with syntax highlighting and Git integration'
|
8
|
+
@url = 'https://github.com/sharkdp/bat'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
__END__
|
13
|
+
|
14
|
+
|
15
|
+
A cat(1) clone with syntax highlighting and Git integration.
|
16
|
+
|
17
|
+
Usage: bat [OPTIONS] [FILE]...
|
18
|
+
bat <COMMAND>
|
19
|
+
|
20
|
+
Arguments:
|
21
|
+
[FILE]...
|
22
|
+
File(s) to print / concatenate. Use a dash ('-') or no argument at all to read from
|
23
|
+
standard input.
|
24
|
+
|
25
|
+
Options:
|
26
|
+
-A, --show-all
|
27
|
+
Show non-printable characters like space, tab or newline. This option can also be
|
28
|
+
used to print binary files. Use '--tabs' to control the width of the
|
29
|
+
tab-placeholders.
|
30
|
+
|
31
|
+
--nonprintable-notation <notation>
|
32
|
+
Set notation for non-printable characters.
|
33
|
+
|
34
|
+
Possible values:
|
35
|
+
* unicode (␇, ␊, ␀, ..)
|
36
|
+
* caret (^G, ^J, ^@, ..)
|
37
|
+
|
38
|
+
-p, --plain...
|
39
|
+
Only show plain style, no decorations. This is an alias for '--style=plain'. When
|
40
|
+
'-p' is used twice ('-pp'), it also disables automatic paging (alias for
|
41
|
+
'--style=plain --paging=never').
|
42
|
+
|
43
|
+
-l, --language <language>
|
44
|
+
Explicitly set the language for syntax highlighting. The language can be specified as
|
45
|
+
a name (like 'C++' or 'LaTeX') or possible file extension (like 'cpp', 'hpp' or
|
46
|
+
'md'). Use '--list-languages' to show all supported language names and file
|
47
|
+
extensions.
|
48
|
+
|
49
|
+
-H, --highlight-line <N:M>
|
50
|
+
Highlight the specified line ranges with a different background color For example:
|
51
|
+
'--highlight-line 40' highlights line 40
|
52
|
+
'--highlight-line 30:40' highlights lines 30 to 40
|
53
|
+
'--highlight-line :40' highlights lines 1 to 40
|
54
|
+
'--highlight-line 40:' highlights lines 40 to the end of the file
|
55
|
+
'--highlight-line 30:+10' highlights lines 30 to 40
|
56
|
+
|
57
|
+
--file-name <name>
|
58
|
+
Specify the name to display for a file. Useful when piping data to bat from STDIN
|
59
|
+
when bat does not otherwise know the filename. Note that the provided file name is
|
60
|
+
also used for syntax detection.
|
61
|
+
|
62
|
+
-d, --diff
|
63
|
+
Only show lines that have been added/removed/modified with respect to the Git index.
|
64
|
+
Use --diff-context=N to control how much context you want to see.
|
65
|
+
|
66
|
+
--diff-context <N>
|
67
|
+
Include N lines of context around added/removed/modified lines when using '--diff'.
|
68
|
+
|
69
|
+
--tabs <T>
|
70
|
+
Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
|
71
|
+
|
72
|
+
--wrap <mode>
|
73
|
+
Specify the text-wrapping mode (*auto*, never, character). The '--terminal-width'
|
74
|
+
option can be used in addition to control the output width.
|
75
|
+
|
76
|
+
-S, --chop-long-lines
|
77
|
+
Truncate all lines longer than screen width. Alias for '--wrap=never'.
|
78
|
+
|
79
|
+
--terminal-width <width>
|
80
|
+
Explicitly set the width of the terminal instead of determining it automatically. If
|
81
|
+
prefixed with '+' or '-', the value will be treated as an offset to the actual
|
82
|
+
terminal width. See also: '--wrap'.
|
83
|
+
|
84
|
+
-n, --number
|
85
|
+
Only show line numbers, no other decorations. This is an alias for '--style=numbers'
|
86
|
+
|
87
|
+
--color <when>
|
88
|
+
Specify when to use colored output. The automatic mode only enables colors if an
|
89
|
+
interactive terminal is detected - colors are automatically disabled if the output
|
90
|
+
goes to a pipe.
|
91
|
+
Possible values: *auto*, never, always.
|
92
|
+
|
93
|
+
--italic-text <when>
|
94
|
+
Specify when to use ANSI sequences for italic text in the output. Possible values:
|
95
|
+
always, *never*.
|
96
|
+
|
97
|
+
--decorations <when>
|
98
|
+
Specify when to use the decorations that have been specified via '--style'. The
|
99
|
+
automatic mode only enables decorations if an interactive terminal is detected.
|
100
|
+
Possible values: *auto*, never, always.
|
101
|
+
|
102
|
+
-f, --force-colorization
|
103
|
+
Alias for '--decorations=always --color=always'. This is useful if the output of bat
|
104
|
+
is piped to another program, but you want to keep the colorization/decorations.
|
105
|
+
|
106
|
+
--paging <when>
|
107
|
+
Specify when to use the pager. To disable the pager, use --paging=never' or its
|
108
|
+
alias,'-P'. To disable the pager permanently, set BAT_PAGING to 'never'. To control
|
109
|
+
which pager is used, see the '--pager' option. Possible values: *auto*, never,
|
110
|
+
always.
|
111
|
+
|
112
|
+
--pager <command>
|
113
|
+
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
114
|
+
environment variables. The default pager is 'less'. To control when the pager is
|
115
|
+
used, see the '--paging' option. Example: '--pager "less -RF"'.
|
116
|
+
|
117
|
+
-m, --map-syntax <glob:syntax>
|
118
|
+
Map a glob pattern to an existing syntax name. The glob pattern is matched on the
|
119
|
+
full path and the filename. For example, to highlight *.build files with the Python
|
120
|
+
syntax, use -m '*.build:Python'. To highlight files named '.myignore' with the Git
|
121
|
+
Ignore syntax, use -m '.myignore:Git Ignore'. Note that the right-hand side is the
|
122
|
+
*name* of the syntax, not a file extension.
|
123
|
+
|
124
|
+
--ignored-suffix <ignored-suffix>
|
125
|
+
Ignore extension. For example:
|
126
|
+
'bat --ignored-suffix ".dev" my_file.json.dev' will use JSON syntax, and ignore
|
127
|
+
'.dev'
|
128
|
+
|
129
|
+
--theme <theme>
|
130
|
+
Set the theme for syntax highlighting. Use '--list-themes' to see all available
|
131
|
+
themes. To set a default theme, add the '--theme="..."' option to the configuration
|
132
|
+
file or export the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
|
133
|
+
|
134
|
+
--list-themes
|
135
|
+
Display a list of supported themes for syntax highlighting.
|
136
|
+
|
137
|
+
--style <components>
|
138
|
+
Configure which elements (line numbers, file headers, grid borders, Git
|
139
|
+
modifications, ..) to display in addition to the file contents. The argument is a
|
140
|
+
comma-separated list of components to display (e.g. 'numbers,changes,grid') or a
|
141
|
+
pre-defined style ('full'). To set a default style, add the '--style=".."' option to
|
142
|
+
the configuration file or export the BAT_STYLE environment variable (e.g.: export
|
143
|
+
BAT_STYLE="..").
|
144
|
+
|
145
|
+
Possible values:
|
146
|
+
|
147
|
+
* default: enables recommended style components (default).
|
148
|
+
* full: enables all available components.
|
149
|
+
* auto: same as 'default', unless the output is piped.
|
150
|
+
* plain: disables all available components.
|
151
|
+
* changes: show Git modification markers.
|
152
|
+
* header: alias for 'header-filename'.
|
153
|
+
* header-filename: show filenames before the content.
|
154
|
+
* header-filesize: show file sizes before the content.
|
155
|
+
* grid: vertical/horizontal lines to separate side bar
|
156
|
+
and the header from the content.
|
157
|
+
* rule: horizontal lines to delimit files.
|
158
|
+
* numbers: show line numbers in the side bar.
|
159
|
+
* snip: draw separation lines between distinct line ranges.
|
160
|
+
|
161
|
+
-r, --line-range <N:M>
|
162
|
+
Only print the specified range of lines for each file. For example:
|
163
|
+
'--line-range 30:40' prints lines 30 to 40
|
164
|
+
'--line-range :40' prints lines 1 to 40
|
165
|
+
'--line-range 40:' prints lines 40 to the end of the file
|
166
|
+
'--line-range 40' only prints line 40
|
167
|
+
'--line-range 30:+10' prints lines 30 to 40
|
168
|
+
|
169
|
+
-L, --list-languages
|
170
|
+
Display a list of supported languages for syntax highlighting.
|
171
|
+
|
172
|
+
-u, --unbuffered
|
173
|
+
This option exists for POSIX-compliance reasons ('u' is for 'unbuffered'). The output
|
174
|
+
is always unbuffered - this option is simply ignored.
|
175
|
+
|
176
|
+
--diagnostic
|
177
|
+
Show diagnostic information for bug reports.
|
178
|
+
|
179
|
+
--acknowledgements
|
180
|
+
Show acknowledgements.
|
181
|
+
|
182
|
+
-h, --help
|
183
|
+
Print help (see a summary with '-h')
|
184
|
+
|
185
|
+
-V, --version
|
186
|
+
Print version
|
187
|
+
|
188
|
+
You can use 'bat cache' to customize syntaxes and themes. See 'bat cache --help' for more
|
189
|
+
information
|