on master help sign in
Remove deprecated PrettyPrinter methods
060b998sharkdp
CHANGELOG.md+6
@@ -35,6 +35,12 @@
35
35
36## `bat` as a library
36## `bat` as a library
37
37
38+- The following `PrettyPrinter` methods have been removed (they were previously deprecated):
39+ - `input_stdin_with_name`
40+ - `input_from_bytes_with_name`
41+ - `input_from_reader_with_name`
42+ - `vcs_modification_markers` (if the `git` feature is not enabled)
43+
38## Packaging
44## Packaging
39
45
40- `bat` is now available on snapstore with package name called `batcat`, see #1401 (@purveshpatel511)
46- `bat` is now available on snapstore with package name called `batcat`, see #1401 (@purveshpatel511)
src/pretty_printer.rs+2−43
@@ -90,48 +90,17 @@ impl<'a> PrettyPrinter<'a> {
90 self
90 self
91 }
91 }
92
92
93− /// Add STDIN as an input (with customized name)
94− #[deprecated]
95− pub fn input_stdin_with_name(&mut self, name: impl AsRef<OsStr>) -> &mut Self {
96− self.inputs
97− .push(Input::from_stdin().name(name).kind("File"));
98− self
99− }
100−
101 /// Add a byte string as an input
93 /// Add a byte string as an input
102 pub fn input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self {
94 pub fn input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self {
103 self.input_from_reader(content)
95 self.input_from_reader(content)
104 }
96 }
105
97
106− /// Add a byte string as an input (with customized name)
107− #[deprecated]
108− #[allow(deprecated)]
109− pub fn input_from_bytes_with_name(
110− &mut self,
111− content: &'a [u8],
112− name: impl AsRef<OsStr>,
113− ) -> &mut Self {
114− self.input_from_reader_with_name(content, name)
115− }
116−
117 /// Add a custom reader as an input
98 /// Add a custom reader as an input
118 pub fn input_from_reader<R: Read + 'a>(&mut self, reader: R) -> &mut Self {
99 pub fn input_from_reader<R: Read + 'a>(&mut self, reader: R) -> &mut Self {
119 self.inputs.push(Input::from_reader(reader));
100 self.inputs.push(Input::from_reader(reader));
120 self
101 self
121 }
102 }
122
103
123− /// Add a custom reader as an input (with customized name)
124− #[deprecated]
125− pub fn input_from_reader_with_name<R: Read + 'a>(
126− &mut self,
127− reader: R,
128− name: impl AsRef<OsStr>,
129− ) -> &mut Self {
130− self.inputs
131− .push(Input::from_reader(reader).name(name).kind("File"));
132− self
133− }
134−
135 /// Specify the syntax file which should be used (default: auto-detect)
104 /// Specify the syntax file which should be used (default: auto-detect)
136 pub fn language(&mut self, language: &'a str) -> &mut Self {
105 pub fn language(&mut self, language: &'a str) -> &mut Self {
137 self.config.language = Some(language);
106 self.config.language = Some(language);
@@ -188,19 +157,9 @@ impl<'a> PrettyPrinter<'a> {
188
157
189 /// Whether to show modification markers for VCS changes. This has no effect if
158 /// Whether to show modification markers for VCS changes. This has no effect if
190 /// the `git` feature is not activated.
159 /// the `git` feature is not activated.
191− #[cfg_attr(
192− not(feature = "git"),
160+ #[cfg(feature = "git")]
193− deprecated(
194− note = "Using vcs_modification_markers without the 'git' feature has no effect. \
195− The function will be removed (for non-'git' use cases) in the future."
196− )
197− )]
198− #[allow(unused_variables)]
199 pub fn vcs_modification_markers(&mut self, yes: bool) -> &mut Self {
161 pub fn vcs_modification_markers(&mut self, yes: bool) -> &mut Self {
200− #[cfg(feature = "git")]
201− {
202− self.active_style_components.vcs_modification_markers = yes;
162+ self.active_style_components.vcs_modification_markers = yes;
203− }
204 self
163 self
205 }
164 }
206
165