Merge pull request #526 from est31/remove_crate_vis

Replace crate visibility identifier with pub(crate)
This commit is contained in:
Jonathan Turner 2019-08-30 03:53:09 +12:00 committed by GitHub
commit e5d67d5481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 339 additions and 339 deletions

View File

@ -7,7 +7,7 @@ use crate::commands::plugin::JsonRpc;
use crate::commands::plugin::{PluginCommand, PluginSink}; use crate::commands::plugin::{PluginCommand, PluginSink};
use crate::commands::whole_stream_command; use crate::commands::whole_stream_command;
use crate::context::Context; use crate::context::Context;
crate use crate::errors::ShellError; pub(crate) use crate::errors::ShellError;
use crate::git::current_branch; use crate::git::current_branch;
use crate::object::Value; use crate::object::Value;
use crate::parser::registry::Signature; use crate::parser::registry::Signature;

View File

@ -1,121 +1,121 @@
#[macro_use] #[macro_use]
crate mod macros; pub(crate) mod macros;
crate mod args; pub(crate) mod args;
crate mod autoview; pub(crate) mod autoview;
crate mod cd; pub(crate) mod cd;
crate mod classified; pub(crate) mod classified;
crate mod clip; pub(crate) mod clip;
crate mod command; pub(crate) mod command;
crate mod config; pub(crate) mod config;
crate mod cp; pub(crate) mod cp;
crate mod date; pub(crate) mod date;
crate mod debug; pub(crate) mod debug;
crate mod enter; pub(crate) mod enter;
crate mod exit; pub(crate) mod exit;
crate mod first; pub(crate) mod first;
crate mod from_array; pub(crate) mod from_array;
crate mod from_bson; pub(crate) mod from_bson;
crate mod from_csv; pub(crate) mod from_csv;
crate mod from_ini; pub(crate) mod from_ini;
crate mod from_json; pub(crate) mod from_json;
crate mod from_toml; pub(crate) mod from_toml;
crate mod from_tsv; pub(crate) mod from_tsv;
crate mod from_xml; pub(crate) mod from_xml;
crate mod from_yaml; pub(crate) mod from_yaml;
crate mod get; pub(crate) mod get;
crate mod last; pub(crate) mod last;
crate mod lines; pub(crate) mod lines;
crate mod ls; pub(crate) mod ls;
crate mod mkdir; pub(crate) mod mkdir;
crate mod mv; pub(crate) mod mv;
crate mod next; pub(crate) mod next;
crate mod nth; pub(crate) mod nth;
crate mod open; pub(crate) mod open;
crate mod pick; pub(crate) mod pick;
crate mod plugin; pub(crate) mod plugin;
crate mod prev; pub(crate) mod prev;
crate mod ps; pub(crate) mod ps;
crate mod reject; pub(crate) mod reject;
crate mod reverse; pub(crate) mod reverse;
crate mod rm; pub(crate) mod rm;
crate mod save; pub(crate) mod save;
crate mod shells; pub(crate) mod shells;
crate mod size; pub(crate) mod size;
crate mod skip_while; pub(crate) mod skip_while;
crate mod sort_by; pub(crate) mod sort_by;
crate mod split_column; pub(crate) mod split_column;
crate mod split_row; pub(crate) mod split_row;
crate mod table; pub(crate) mod table;
crate mod tags; pub(crate) mod tags;
crate mod to_array; pub(crate) mod to_array;
crate mod to_bson; pub(crate) mod to_bson;
crate mod to_csv; pub(crate) mod to_csv;
crate mod to_json; pub(crate) mod to_json;
crate mod to_toml; pub(crate) mod to_toml;
crate mod to_tsv; pub(crate) mod to_tsv;
crate mod to_yaml; pub(crate) mod to_yaml;
crate mod trim; pub(crate) mod trim;
crate mod version; pub(crate) mod version;
crate mod vtable; pub(crate) mod vtable;
crate mod where_; pub(crate) mod where_;
crate mod which_; pub(crate) mod which_;
crate use autoview::Autoview; pub(crate) use autoview::Autoview;
crate use cd::CD; pub(crate) use cd::CD;
crate use command::{ pub(crate) use command::{
per_item_command, whole_stream_command, Command, PerItemCommand, RawCommandArgs, per_item_command, whole_stream_command, Command, PerItemCommand, RawCommandArgs,
UnevaluatedCallInfo, WholeStreamCommand, UnevaluatedCallInfo, WholeStreamCommand,
}; };
crate use config::Config; pub(crate) use config::Config;
crate use cp::Cpy; pub(crate) use cp::Cpy;
crate use date::Date; pub(crate) use date::Date;
crate use debug::Debug; pub(crate) use debug::Debug;
crate use enter::Enter; pub(crate) use enter::Enter;
crate use exit::Exit; pub(crate) use exit::Exit;
crate use first::First; pub(crate) use first::First;
crate use from_array::FromArray; pub(crate) use from_array::FromArray;
crate use from_bson::FromBSON; pub(crate) use from_bson::FromBSON;
crate use from_csv::FromCSV; pub(crate) use from_csv::FromCSV;
crate use from_ini::FromINI; pub(crate) use from_ini::FromINI;
crate use from_json::FromJSON; pub(crate) use from_json::FromJSON;
crate use from_toml::FromTOML; pub(crate) use from_toml::FromTOML;
crate use from_tsv::FromTSV; pub(crate) use from_tsv::FromTSV;
crate use from_xml::FromXML; pub(crate) use from_xml::FromXML;
crate use from_yaml::FromYAML; pub(crate) use from_yaml::FromYAML;
crate use get::Get; pub(crate) use get::Get;
crate use last::Last; pub(crate) use last::Last;
crate use lines::Lines; pub(crate) use lines::Lines;
crate use ls::LS; pub(crate) use ls::LS;
crate use mkdir::Mkdir; pub(crate) use mkdir::Mkdir;
crate use mv::Move; pub(crate) use mv::Move;
crate use next::Next; pub(crate) use next::Next;
crate use nth::Nth; pub(crate) use nth::Nth;
crate use open::Open; pub(crate) use open::Open;
crate use pick::Pick; pub(crate) use pick::Pick;
crate use prev::Previous; pub(crate) use prev::Previous;
crate use ps::PS; pub(crate) use ps::PS;
crate use reject::Reject; pub(crate) use reject::Reject;
crate use reverse::Reverse; pub(crate) use reverse::Reverse;
crate use rm::Remove; pub(crate) use rm::Remove;
crate use save::Save; pub(crate) use save::Save;
crate use shells::Shells; pub(crate) use shells::Shells;
crate use size::Size; pub(crate) use size::Size;
crate use skip_while::SkipWhile; pub(crate) use skip_while::SkipWhile;
crate use sort_by::SortBy; pub(crate) use sort_by::SortBy;
crate use split_column::SplitColumn; pub(crate) use split_column::SplitColumn;
crate use split_row::SplitRow; pub(crate) use split_row::SplitRow;
crate use table::Table; pub(crate) use table::Table;
crate use tags::Tags; pub(crate) use tags::Tags;
crate use to_array::ToArray; pub(crate) use to_array::ToArray;
crate use to_bson::ToBSON; pub(crate) use to_bson::ToBSON;
crate use to_csv::ToCSV; pub(crate) use to_csv::ToCSV;
crate use to_json::ToJSON; pub(crate) use to_json::ToJSON;
crate use to_toml::ToTOML; pub(crate) use to_toml::ToTOML;
crate use to_tsv::ToTSV; pub(crate) use to_tsv::ToTSV;
crate use to_yaml::ToYAML; pub(crate) use to_yaml::ToYAML;
crate use trim::Trim; pub(crate) use trim::Trim;
crate use version::Version; pub(crate) use version::Version;
crate use vtable::VTable; pub(crate) use vtable::VTable;
crate use where_::Where; pub(crate) use where_::Where;
crate use which_::Which; pub(crate) use which_::Which;

View File

@ -45,27 +45,27 @@ impl Decoder for LinesCodec {
} }
} }
crate struct ClassifiedInputStream { pub(crate) struct ClassifiedInputStream {
crate objects: InputStream, pub(crate) objects: InputStream,
crate stdin: Option<std::fs::File>, pub(crate) stdin: Option<std::fs::File>,
} }
impl ClassifiedInputStream { impl ClassifiedInputStream {
crate fn new() -> ClassifiedInputStream { pub(crate) fn new() -> ClassifiedInputStream {
ClassifiedInputStream { ClassifiedInputStream {
objects: VecDeque::new().into(), objects: VecDeque::new().into(),
stdin: None, stdin: None,
} }
} }
crate fn from_input_stream(stream: impl Into<InputStream>) -> ClassifiedInputStream { pub(crate) fn from_input_stream(stream: impl Into<InputStream>) -> ClassifiedInputStream {
ClassifiedInputStream { ClassifiedInputStream {
objects: stream.into(), objects: stream.into(),
stdin: None, stdin: None,
} }
} }
crate fn from_stdout(stdout: std::fs::File) -> ClassifiedInputStream { pub(crate) fn from_stdout(stdout: std::fs::File) -> ClassifiedInputStream {
ClassifiedInputStream { ClassifiedInputStream {
objects: VecDeque::new().into(), objects: VecDeque::new().into(),
stdin: Some(stdout), stdin: Some(stdout),
@ -73,11 +73,11 @@ impl ClassifiedInputStream {
} }
} }
crate struct ClassifiedPipeline { pub(crate) struct ClassifiedPipeline {
crate commands: Vec<ClassifiedCommand>, pub(crate) commands: Vec<ClassifiedCommand>,
} }
crate enum ClassifiedCommand { pub(crate) enum ClassifiedCommand {
#[allow(unused)] #[allow(unused)]
Expr(TokenNode), Expr(TokenNode),
Internal(InternalCommand), Internal(InternalCommand),
@ -95,14 +95,14 @@ impl ClassifiedCommand {
} }
} }
crate struct InternalCommand { pub(crate) struct InternalCommand {
crate command: Arc<Command>, pub(crate) command: Arc<Command>,
crate name_span: Span, pub(crate) name_span: Span,
crate args: hir::Call, pub(crate) args: hir::Call,
} }
impl InternalCommand { impl InternalCommand {
crate async fn run( pub(crate) async fn run(
self, self,
context: &mut Context, context: &mut Context,
input: ClassifiedInputStream, input: ClassifiedInputStream,
@ -218,21 +218,21 @@ impl InternalCommand {
} }
} }
crate struct ExternalCommand { pub(crate) struct ExternalCommand {
crate name: String, pub(crate) name: String,
#[allow(unused)] #[allow(unused)]
crate name_span: Span, pub(crate) name_span: Span,
crate args: Vec<Tagged<String>>, pub(crate) args: Vec<Tagged<String>>,
} }
crate enum StreamNext { pub(crate) enum StreamNext {
Last, Last,
External, External,
Internal, Internal,
} }
impl ExternalCommand { impl ExternalCommand {
crate async fn run( pub(crate) async fn run(
self, self,
context: &mut Context, context: &mut Context,
input: ClassifiedInputStream, input: ClassifiedInputStream,

View File

@ -3,7 +3,7 @@ use crate::{EntriesListView, GenericView, TreeView};
use futures::stream::{self, StreamExt}; use futures::stream::{self, StreamExt};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
crate fn format(input: Vec<Value>, host: &mut dyn Host) { pub(crate) fn format(input: Vec<Value>, host: &mut dyn Host) {
let last = input.len() - 1; let last = input.len() - 1;
for (i, item) in input.iter().enumerate() { for (i, item) in input.iter().enumerate() {
let view = GenericView::new(item); let view = GenericView::new(item);

View File

@ -41,13 +41,13 @@ pub struct CommandRegistry {
} }
impl CommandRegistry { impl CommandRegistry {
crate fn empty() -> CommandRegistry { pub(crate) fn empty() -> CommandRegistry {
CommandRegistry { CommandRegistry {
registry: Arc::new(Mutex::new(IndexMap::default())), registry: Arc::new(Mutex::new(IndexMap::default())),
} }
} }
crate fn get_command(&self, name: &str) -> Option<Arc<Command>> { pub(crate) fn get_command(&self, name: &str) -> Option<Arc<Command>> {
let registry = self.registry.lock().unwrap(); let registry = self.registry.lock().unwrap();
registry.get(name).map(|c| c.clone()) registry.get(name).map(|c| c.clone())
@ -64,7 +64,7 @@ impl CommandRegistry {
registry.insert(name.into(), command); registry.insert(name.into(), command);
} }
crate fn names(&self) -> Vec<String> { pub(crate) fn names(&self) -> Vec<String> {
let registry = self.registry.lock().unwrap(); let registry = self.registry.lock().unwrap();
registry.keys().cloned().collect() registry.keys().cloned().collect()
} }
@ -73,17 +73,17 @@ impl CommandRegistry {
#[derive(Clone)] #[derive(Clone)]
pub struct Context { pub struct Context {
registry: CommandRegistry, registry: CommandRegistry,
crate source_map: SourceMap, pub(crate) source_map: SourceMap,
host: Arc<Mutex<dyn Host + Send>>, host: Arc<Mutex<dyn Host + Send>>,
crate shell_manager: ShellManager, pub(crate) shell_manager: ShellManager,
} }
impl Context { impl Context {
crate fn registry(&self) -> &CommandRegistry { pub(crate) fn registry(&self) -> &CommandRegistry {
&self.registry &self.registry
} }
crate fn basic() -> Result<Context, Box<dyn Error>> { pub(crate) fn basic() -> Result<Context, Box<dyn Error>> {
let registry = CommandRegistry::new(); let registry = CommandRegistry::new();
Ok(Context { Ok(Context {
registry: registry.clone(), registry: registry.clone(),
@ -93,7 +93,7 @@ impl Context {
}) })
} }
crate fn with_host(&mut self, block: impl FnOnce(&mut dyn Host)) { pub(crate) fn with_host(&mut self, block: impl FnOnce(&mut dyn Host)) {
let mut host = self.host.lock().unwrap(); let mut host = self.host.lock().unwrap();
block(&mut *host) block(&mut *host)
@ -109,15 +109,15 @@ impl Context {
self.source_map.insert(uuid, span_source); self.source_map.insert(uuid, span_source);
} }
crate fn has_command(&self, name: &str) -> bool { pub(crate) fn has_command(&self, name: &str) -> bool {
self.registry.has(name) self.registry.has(name)
} }
crate fn get_command(&self, name: &str) -> Arc<Command> { pub(crate) fn get_command(&self, name: &str) -> Arc<Command> {
self.registry.get_command(name).unwrap() self.registry.get_command(name).unwrap()
} }
crate fn run_command<'a>( pub(crate) fn run_command<'a>(
&mut self, &mut self,
command: Arc<Command>, command: Arc<Command>,
name_span: Span, name_span: Span,

View File

@ -1,3 +1,3 @@
crate mod host; pub(crate) mod host;
crate use self::host::Host; pub(crate) use self::host::Host;

2
src/env/host.rs vendored
View File

@ -73,7 +73,7 @@ impl Host for BasicHost {
} }
} }
crate fn handle_unexpected<T>( pub(crate) fn handle_unexpected<T>(
host: &mut dyn Host, host: &mut dyn Host,
func: impl FnOnce(&mut dyn Host) -> Result<T, ShellError>, func: impl FnOnce(&mut dyn Host) -> Result<T, ShellError>,
) { ) {

View File

@ -73,7 +73,7 @@ impl serde::de::Error for ShellError {
} }
impl ShellError { impl ShellError {
crate fn type_error( pub(crate) fn type_error(
expected: impl Into<String>, expected: impl Into<String>,
actual: Tagged<impl Into<String>>, actual: Tagged<impl Into<String>>,
) -> ShellError { ) -> ShellError {
@ -84,21 +84,21 @@ impl ShellError {
.start() .start()
} }
crate fn syntax_error(problem: Tagged<impl Into<String>>) -> ShellError { pub(crate) fn syntax_error(problem: Tagged<impl Into<String>>) -> ShellError {
ProximateShellError::SyntaxError { ProximateShellError::SyntaxError {
problem: problem.map(|p| p.into()), problem: problem.map(|p| p.into()),
} }
.start() .start()
} }
crate fn invalid_command(problem: impl Into<Tag>) -> ShellError { pub(crate) fn invalid_command(problem: impl Into<Tag>) -> ShellError {
ProximateShellError::InvalidCommand { ProximateShellError::InvalidCommand {
command: problem.into(), command: problem.into(),
} }
.start() .start()
} }
crate fn coerce_error( pub(crate) fn coerce_error(
left: Tagged<impl Into<String>>, left: Tagged<impl Into<String>>,
right: Tagged<impl Into<String>>, right: Tagged<impl Into<String>>,
) -> ShellError { ) -> ShellError {
@ -109,11 +109,11 @@ impl ShellError {
.start() .start()
} }
crate fn missing_property(subpath: Description, expr: Description) -> ShellError { pub(crate) fn missing_property(subpath: Description, expr: Description) -> ShellError {
ProximateShellError::MissingProperty { subpath, expr }.start() ProximateShellError::MissingProperty { subpath, expr }.start()
} }
crate fn missing_value(span: Option<Span>, reason: impl Into<String>) -> ShellError { pub(crate) fn missing_value(span: Option<Span>, reason: impl Into<String>) -> ShellError {
ProximateShellError::MissingValue { ProximateShellError::MissingValue {
span, span,
reason: reason.into(), reason: reason.into(),
@ -121,7 +121,7 @@ impl ShellError {
.start() .start()
} }
crate fn argument_error( pub(crate) fn argument_error(
command: impl Into<String>, command: impl Into<String>,
kind: ArgumentError, kind: ArgumentError,
span: Span, span: Span,
@ -134,7 +134,7 @@ impl ShellError {
.start() .start()
} }
crate fn parse_error( pub(crate) fn parse_error(
error: nom::Err<(nom5_locate::LocatedSpan<&str>, nom::error::ErrorKind)>, error: nom::Err<(nom5_locate::LocatedSpan<&str>, nom::error::ErrorKind)>,
) -> ShellError { ) -> ShellError {
use language_reporting::*; use language_reporting::*;
@ -158,11 +158,11 @@ impl ShellError {
} }
} }
crate fn diagnostic(diagnostic: Diagnostic<Span>) -> ShellError { pub(crate) fn diagnostic(diagnostic: Diagnostic<Span>) -> ShellError {
ProximateShellError::Diagnostic(ShellDiagnostic { diagnostic }).start() ProximateShellError::Diagnostic(ShellDiagnostic { diagnostic }).start()
} }
crate fn to_diagnostic(self) -> Diagnostic<Span> { pub(crate) fn to_diagnostic(self) -> Diagnostic<Span> {
match self.error { match self.error {
ProximateShellError::String(StringError { title, .. }) => { ProximateShellError::String(StringError { title, .. }) => {
Diagnostic::new(Severity::Error, title) Diagnostic::new(Severity::Error, title)
@ -309,11 +309,11 @@ impl ShellError {
ProximateShellError::String(StringError::new(title.into(), Value::nothing())).start() ProximateShellError::String(StringError::new(title.into(), Value::nothing())).start()
} }
crate fn unimplemented(title: impl Into<String>) -> ShellError { pub(crate) fn unimplemented(title: impl Into<String>) -> ShellError {
ShellError::string(&format!("Unimplemented: {}", title.into())) ShellError::string(&format!("Unimplemented: {}", title.into()))
} }
crate fn unexpected(title: impl Into<String>) -> ShellError { pub(crate) fn unexpected(title: impl Into<String>) -> ShellError {
ShellError::string(&format!("Unexpected: {}", title.into())) ShellError::string(&format!("Unexpected: {}", title.into()))
} }
} }
@ -369,12 +369,12 @@ impl ToDebug for ProximateShellError {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShellDiagnostic { pub struct ShellDiagnostic {
crate diagnostic: Diagnostic<Span>, pub(crate) diagnostic: Diagnostic<Span>,
} }
impl ShellDiagnostic { impl ShellDiagnostic {
#[allow(unused)] #[allow(unused)]
crate fn simple_diagnostic( pub(crate) fn simple_diagnostic(
span: impl Into<Span>, span: impl Into<Span>,
source: impl Into<String>, source: impl Into<String>,
) -> ShellDiagnostic { ) -> ShellDiagnostic {

View File

@ -16,14 +16,14 @@ pub struct Scope {
} }
impl Scope { impl Scope {
crate fn empty() -> Scope { pub(crate) fn empty() -> Scope {
Scope { Scope {
it: Value::nothing().tagged_unknown(), it: Value::nothing().tagged_unknown(),
vars: IndexMap::new(), vars: IndexMap::new(),
} }
} }
crate fn it_value(value: Tagged<Value>) -> Scope { pub(crate) fn it_value(value: Tagged<Value>) -> Scope {
Scope { Scope {
it: value, it: value,
vars: IndexMap::new(), vars: IndexMap::new(),
@ -31,7 +31,7 @@ impl Scope {
} }
} }
crate fn evaluate_baseline_expr( pub(crate) fn evaluate_baseline_expr(
expr: &Expression, expr: &Expression,
registry: &CommandRegistry, registry: &CommandRegistry,
scope: &Scope, scope: &Scope,

View File

@ -1,3 +1,3 @@
crate mod evaluator; pub(crate) mod evaluator;
crate use evaluator::{evaluate_baseline_expr, Scope}; pub(crate) use evaluator::{evaluate_baseline_expr, Scope};

View File

@ -1,21 +1,21 @@
crate mod entries; pub(crate) mod entries;
crate mod generic; pub(crate) mod generic;
crate mod list; pub(crate) mod list;
crate mod table; pub(crate) mod table;
crate mod vtable; pub(crate) mod vtable;
use crate::prelude::*; use crate::prelude::*;
crate use entries::EntriesView; pub(crate) use entries::EntriesView;
#[allow(unused)] #[allow(unused)]
crate use generic::GenericView; pub(crate) use generic::GenericView;
crate use table::TableView; pub(crate) use table::TableView;
crate use vtable::VTableView; pub(crate) use vtable::VTableView;
crate trait RenderView { pub(crate) trait RenderView {
fn render_view(&self, host: &mut dyn Host) -> Result<(), ShellError>; fn render_view(&self, host: &mut dyn Host) -> Result<(), ShellError>;
} }
crate fn print_view(view: &impl RenderView, host: &mut dyn Host) -> Result<(), ShellError> { pub(crate) fn print_view(view: &impl RenderView, host: &mut dyn Host) -> Result<(), ShellError> {
view.render_view(host) view.render_view(host)
} }

View File

@ -14,7 +14,7 @@ pub struct EntriesView {
} }
impl EntriesView { impl EntriesView {
crate fn from_value(value: &Value) -> EntriesView { pub(crate) fn from_value(value: &Value) -> EntriesView {
let descs = value.data_descriptors(); let descs = value.data_descriptors();
let mut entries = vec![]; let mut entries = vec![];

View File

@ -1,13 +1,13 @@
crate mod base; pub(crate) mod base;
crate mod config; pub(crate) mod config;
crate mod dict; pub(crate) mod dict;
crate mod files; pub(crate) mod files;
crate mod into; pub(crate) mod into;
crate mod meta; pub(crate) mod meta;
crate mod process; pub(crate) mod process;
crate mod types; pub(crate) mod types;
#[allow(unused)] #[allow(unused)]
crate use base::{Block, Primitive, Switch, Value}; pub(crate) use base::{Block, Primitive, Switch, Value};
crate use dict::{Dictionary, TaggedDictBuilder}; pub(crate) use dict::{Dictionary, TaggedDictBuilder};
crate use files::dir_entry_dict; pub(crate) use files::dir_entry_dict;

View File

@ -16,11 +16,11 @@ use std::time::SystemTime;
#[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, new, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, new, Serialize, Deserialize)]
pub struct OF64 { pub struct OF64 {
crate inner: OrderedFloat<f64>, pub(crate) inner: OrderedFloat<f64>,
} }
impl OF64 { impl OF64 {
crate fn into_inner(&self) -> f64 { pub(crate) fn into_inner(&self) -> f64 {
self.inner.into_inner() self.inner.into_inner()
} }
} }
@ -49,7 +49,7 @@ pub enum Primitive {
} }
impl Primitive { impl Primitive {
crate fn type_name(&self) -> String { pub(crate) fn type_name(&self) -> String {
use Primitive::*; use Primitive::*;
match self { match self {
@ -67,7 +67,7 @@ impl Primitive {
.to_string() .to_string()
} }
crate fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result { pub(crate) fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result {
use Primitive::*; use Primitive::*;
match self { match self {
@ -130,16 +130,16 @@ impl Primitive {
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Clone, new, Serialize)] #[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Clone, new, Serialize)]
pub struct Operation { pub struct Operation {
crate left: Value, pub(crate) left: Value,
crate operator: Operator, pub(crate) operator: Operator,
crate right: Value, pub(crate) right: Value,
} }
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Clone, Serialize, Deserialize, new)] #[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Clone, Serialize, Deserialize, new)]
pub struct Block { pub struct Block {
crate expressions: Vec<hir::Expression>, pub(crate) expressions: Vec<hir::Expression>,
crate source: Text, pub(crate) source: Text,
crate span: Span, pub(crate) span: Span,
} }
impl Block { impl Block {
@ -209,7 +209,7 @@ impl fmt::Debug for ValueDebug<'a> {
} }
impl Tagged<Value> { impl Tagged<Value> {
crate fn tagged_type_name(&self) -> Tagged<String> { pub(crate) fn tagged_type_name(&self) -> Tagged<String> {
let name = self.type_name(); let name = self.type_name();
Tagged::from_item(name, self.tag()) Tagged::from_item(name, self.tag())
} }
@ -319,13 +319,13 @@ impl std::convert::TryFrom<Option<&'a Tagged<Value>>> for Switch {
} }
impl Tagged<Value> { impl Tagged<Value> {
crate fn debug(&'a self) -> ValueDebug<'a> { pub(crate) fn debug(&'a self) -> ValueDebug<'a> {
ValueDebug { value: self } ValueDebug { value: self }
} }
} }
impl Value { impl Value {
crate fn type_name(&self) -> String { pub(crate) fn type_name(&self) -> String {
match self { match self {
Value::Primitive(p) => p.type_name(), Value::Primitive(p) => p.type_name(),
Value::Object(_) => format!("object"), Value::Object(_) => format!("object"),
@ -351,7 +351,7 @@ impl Value {
} }
} }
crate fn get_data_by_key(&'a self, name: &str) -> Option<&Tagged<Value>> { pub(crate) fn get_data_by_key(&'a self, name: &str) -> Option<&Tagged<Value>> {
match self { match self {
Value::Object(o) => o.get_data_by_key(name), Value::Object(o) => o.get_data_by_key(name),
Value::List(l) => { Value::List(l) => {
@ -374,7 +374,7 @@ impl Value {
} }
#[allow(unused)] #[allow(unused)]
crate fn get_data_by_index(&'a self, idx: usize) -> Option<&Tagged<Value>> { pub(crate) fn get_data_by_index(&'a self, idx: usize) -> Option<&Tagged<Value>> {
match self { match self {
Value::List(l) => l.iter().nth(idx), Value::List(l) => l.iter().nth(idx),
_ => None, _ => None,
@ -491,7 +491,7 @@ impl Value {
} }
} }
crate fn format_leaf(&self, desc: Option<&String>) -> String { pub(crate) fn format_leaf(&self, desc: Option<&String>) -> String {
match self { match self {
Value::Primitive(p) => p.format(desc), Value::Primitive(p) => p.format(desc),
Value::Block(b) => itertools::join( Value::Block(b) => itertools::join(
@ -510,7 +510,7 @@ impl Value {
} }
} }
crate fn style_leaf(&self) -> &'static str { pub(crate) fn style_leaf(&self) -> &'static str {
match self { match self {
Value::Primitive(p) => p.style(), Value::Primitive(p) => p.style(),
_ => "", _ => "",
@ -518,7 +518,7 @@ impl Value {
} }
#[allow(unused)] #[allow(unused)]
crate fn compare(&self, operator: &Operator, other: &Value) -> Result<bool, (String, String)> { pub(crate) fn compare(&self, operator: &Operator, other: &Value) -> Result<bool, (String, String)> {
match operator { match operator {
_ => { _ => {
let coerced = coerce_compare(self, other)?; let coerced = coerce_compare(self, other)?;
@ -545,14 +545,14 @@ impl Value {
} }
#[allow(unused)] #[allow(unused)]
crate fn is_string(&self, expected: &str) -> bool { pub(crate) fn is_string(&self, expected: &str) -> bool {
match self { match self {
Value::Primitive(Primitive::String(s)) if s == expected => true, Value::Primitive(Primitive::String(s)) if s == expected => true,
other => false, other => false,
} }
} }
// crate fn as_pair(&self) -> Result<(Tagged<Value>, Tagged<Value>), ShellError> { // pub(crate) fn as_pair(&self) -> Result<(Tagged<Value>, Tagged<Value>), ShellError> {
// match self { // match self {
// Value::List(list) if list.len() == 2 => Ok((list[0].clone(), list[1].clone())), // Value::List(list) if list.len() == 2 => Ok((list[0].clone(), list[1].clone())),
// other => Err(ShellError::string(format!( // other => Err(ShellError::string(format!(
@ -562,7 +562,7 @@ impl Value {
// } // }
// } // }
crate fn as_string(&self) -> Result<String, ShellError> { pub(crate) fn as_string(&self) -> Result<String, ShellError> {
match self { match self {
Value::Primitive(Primitive::String(s)) => Ok(s.clone()), Value::Primitive(Primitive::String(s)) => Ok(s.clone()),
Value::Primitive(Primitive::Boolean(x)) => Ok(format!("{}", x)), Value::Primitive(Primitive::Boolean(x)) => Ok(format!("{}", x)),
@ -577,7 +577,7 @@ impl Value {
} }
} }
crate fn as_i64(&self) -> Result<i64, ShellError> { pub(crate) fn as_i64(&self) -> Result<i64, ShellError> {
match self { match self {
Value::Primitive(Primitive::Int(i)) => Ok(*i), Value::Primitive(Primitive::Int(i)) => Ok(*i),
Value::Primitive(Primitive::Bytes(b)) => Ok(*b as i64), Value::Primitive(Primitive::Bytes(b)) => Ok(*b as i64),
@ -589,7 +589,7 @@ impl Value {
} }
} }
crate fn is_true(&self) -> bool { pub(crate) fn is_true(&self) -> bool {
match self { match self {
Value::Primitive(Primitive::Boolean(true)) => true, Value::Primitive(Primitive::Boolean(true)) => true,
_ => false, _ => false,
@ -640,7 +640,7 @@ impl Value {
} }
impl Tagged<Value> { impl Tagged<Value> {
crate fn as_path(&self) -> Result<PathBuf, ShellError> { pub(crate) fn as_path(&self) -> Result<PathBuf, ShellError> {
match self.item() { match self.item() {
Value::Primitive(Primitive::Path(path)) => Ok(path.clone()), Value::Primitive(Primitive::Path(path)) => Ok(path.clone()),
other => Err(ShellError::type_error( other => Err(ShellError::type_error(
@ -651,7 +651,7 @@ impl Tagged<Value> {
} }
} }
crate fn select_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> Tagged<Value> { pub(crate) fn select_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> Tagged<Value> {
let mut out = TaggedDictBuilder::new(tag); let mut out = TaggedDictBuilder::new(tag);
let descs = obj.data_descriptors(); let descs = obj.data_descriptors();
@ -666,7 +666,7 @@ crate fn select_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> T
out.into_tagged_value() out.into_tagged_value()
} }
crate fn reject_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> Tagged<Value> { pub(crate) fn reject_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> Tagged<Value> {
let mut out = TaggedDictBuilder::new(tag); let mut out = TaggedDictBuilder::new(tag);
let descs = obj.data_descriptors(); let descs = obj.data_descriptors();
@ -683,7 +683,7 @@ crate fn reject_fields(obj: &Value, fields: &[String], tag: impl Into<Tag>) -> T
} }
#[allow(unused)] #[allow(unused)]
crate fn find(obj: &Value, field: &str, op: &Operator, rhs: &Value) -> bool { pub(crate) fn find(obj: &Value, field: &str, op: &Operator, rhs: &Value) -> bool {
let descs = obj.data_descriptors(); let descs = obj.data_descriptors();
match descs.iter().find(|d| *d == field) { match descs.iter().find(|d| *d == field) {
None => false, None => false,

View File

@ -22,14 +22,14 @@ struct Config {
extra: IndexMap<String, Tagged<Value>>, extra: IndexMap<String, Tagged<Value>>,
} }
crate fn config_path() -> Result<PathBuf, ShellError> { pub(crate) fn config_path() -> Result<PathBuf, ShellError> {
let location = app_root(AppDataType::UserConfig, &APP_INFO) let location = app_root(AppDataType::UserConfig, &APP_INFO)
.map_err(|err| ShellError::string(&format!("Couldn't open config file:\n{}", err)))?; .map_err(|err| ShellError::string(&format!("Couldn't open config file:\n{}", err)))?;
Ok(location.join("config.toml")) Ok(location.join("config.toml"))
} }
crate fn write_config(config: &IndexMap<String, Tagged<Value>>) -> Result<(), ShellError> { pub(crate) fn write_config(config: &IndexMap<String, Tagged<Value>>) -> Result<(), ShellError> {
let location = app_root(AppDataType::UserConfig, &APP_INFO) let location = app_root(AppDataType::UserConfig, &APP_INFO)
.map_err(|err| ShellError::string(&format!("Couldn't open config file:\n{}", err)))?; .map_err(|err| ShellError::string(&format!("Couldn't open config file:\n{}", err)))?;
@ -45,7 +45,7 @@ crate fn write_config(config: &IndexMap<String, Tagged<Value>>) -> Result<(), Sh
Ok(()) Ok(())
} }
crate fn config(span: impl Into<Span>) -> Result<IndexMap<String, Tagged<Value>>, ShellError> { pub(crate) fn config(span: impl Into<Span>) -> Result<IndexMap<String, Tagged<Value>>, ShellError> {
let span = span.into(); let span = span.into();
let location = app_root(AppDataType::UserConfig, &APP_INFO) let location = app_root(AppDataType::UserConfig, &APP_INFO)

View File

@ -79,7 +79,7 @@ impl Dictionary {
} }
} }
crate fn get_data_by_key(&self, name: &str) -> Option<&Tagged<Value>> { pub(crate) fn get_data_by_key(&self, name: &str) -> Option<&Tagged<Value>> {
match self match self
.entries .entries
.iter() .iter()
@ -90,7 +90,7 @@ impl Dictionary {
} }
} }
crate fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result { pub(crate) fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut debug = f.debug_struct("Dictionary"); let mut debug = f.debug_struct("Dictionary");
for (desc, value) in self.entries.iter() { for (desc, value) in self.entries.iter() {

View File

@ -9,7 +9,7 @@ pub enum FileType {
Symlink, Symlink,
} }
crate fn dir_entry_dict( pub(crate) fn dir_entry_dict(
filename: &std::path::Path, filename: &std::path::Path,
metadata: &std::fs::Metadata, metadata: &std::fs::Metadata,
tag: impl Into<Tag>, tag: impl Into<Tag>,

View File

@ -87,7 +87,7 @@ impl<T> Tagged<T> {
Tagged::from_item(mapped, tag.clone()) Tagged::from_item(mapped, tag.clone())
} }
crate fn copy_span<U>(&self, output: U) -> Tagged<U> { pub(crate) fn copy_span<U>(&self, output: U) -> Tagged<U> {
let span = self.span(); let span = self.span();
Tagged::from_simple_spanned_item(output, span) Tagged::from_simple_spanned_item(output, span)
@ -224,8 +224,8 @@ impl Tag {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, Hash)]
pub struct Span { pub struct Span {
crate start: usize, pub(crate) start: usize,
crate end: usize, pub(crate) end: usize,
} }
impl From<Option<Span>> for Span { impl From<Option<Span>> for Span {

View File

@ -3,7 +3,7 @@ use crate::prelude::*;
use itertools::join; use itertools::join;
use sysinfo::ProcessExt; use sysinfo::ProcessExt;
crate fn process_dict(proc: &sysinfo::Process, tag: impl Into<Tag>) -> Tagged<Value> { pub(crate) fn process_dict(proc: &sysinfo::Process, tag: impl Into<Tag>) -> Tagged<Value> {
let mut dict = TaggedDictBuilder::new(tag); let mut dict = TaggedDictBuilder::new(tag);
let cmd = proc.cmd(); let cmd = proc.cmd();

View File

@ -1,25 +1,25 @@
crate mod deserializer; pub(crate) mod deserializer;
crate mod hir; pub(crate) mod hir;
crate mod parse; pub(crate) mod parse;
crate mod parse_command; pub(crate) mod parse_command;
crate mod registry; pub(crate) mod registry;
use crate::errors::ShellError; use crate::errors::ShellError;
crate use deserializer::ConfigDeserializer; pub(crate) use deserializer::ConfigDeserializer;
crate use hir::baseline_parse_tokens::baseline_parse_tokens; pub(crate) use hir::baseline_parse_tokens::baseline_parse_tokens;
crate use parse::call_node::CallNode; pub(crate) use parse::call_node::CallNode;
crate use parse::files::Files; pub(crate) use parse::files::Files;
crate use parse::flag::Flag; pub(crate) use parse::flag::Flag;
crate use parse::operator::Operator; pub(crate) use parse::operator::Operator;
crate use parse::parser::{nom_input, pipeline}; pub(crate) use parse::parser::{nom_input, pipeline};
crate use parse::pipeline::{Pipeline, PipelineElement}; pub(crate) use parse::pipeline::{Pipeline, PipelineElement};
crate use parse::text::Text; pub(crate) use parse::text::Text;
crate use parse::token_tree::{DelimitedNode, Delimiter, PathNode, TokenNode}; pub(crate) use parse::token_tree::{DelimitedNode, Delimiter, PathNode, TokenNode};
crate use parse::tokens::{RawToken, Token}; pub(crate) use parse::tokens::{RawToken, Token};
crate use parse::unit::Unit; pub(crate) use parse::unit::Unit;
crate use parse_command::parse_command; pub(crate) use parse_command::parse_command;
crate use registry::CommandRegistry; pub(crate) use registry::CommandRegistry;
pub fn parse(input: &str) -> Result<TokenNode, ShellError> { pub fn parse(input: &str) -> Result<TokenNode, ShellError> {
let _ = pretty_env_logger::try_init(); let _ = pretty_env_logger::try_init();

View File

@ -1,9 +1,9 @@
crate mod baseline_parse; pub(crate) mod baseline_parse;
crate mod baseline_parse_tokens; pub(crate) mod baseline_parse_tokens;
crate mod binary; pub(crate) mod binary;
crate mod external_command; pub(crate) mod external_command;
crate mod named; pub(crate) mod named;
crate mod path; pub(crate) mod path;
use crate::parser::{registry, Unit}; use crate::parser::{registry, Unit};
use crate::prelude::*; use crate::prelude::*;
@ -15,15 +15,15 @@ use std::path::PathBuf;
use crate::evaluate::Scope; use crate::evaluate::Scope;
crate use self::baseline_parse::{ pub(crate) use self::baseline_parse::{
baseline_parse_single_token, baseline_parse_token_as_number, baseline_parse_token_as_path, baseline_parse_single_token, baseline_parse_token_as_number, baseline_parse_token_as_path,
baseline_parse_token_as_string, baseline_parse_token_as_string,
}; };
crate use self::baseline_parse_tokens::{baseline_parse_next_expr, TokensIterator}; pub(crate) use self::baseline_parse_tokens::{baseline_parse_next_expr, TokensIterator};
crate use self::binary::Binary; pub(crate) use self::binary::Binary;
crate use self::external_command::ExternalCommand; pub(crate) use self::external_command::ExternalCommand;
crate use self::named::NamedArguments; pub(crate) use self::named::NamedArguments;
crate use self::path::Path; pub(crate) use self::path::Path;
pub use self::baseline_parse_tokens::SyntaxType; pub use self::baseline_parse_tokens::SyntaxType;
@ -129,51 +129,51 @@ impl RawExpression {
pub type Expression = Tagged<RawExpression>; pub type Expression = Tagged<RawExpression>;
impl Expression { impl Expression {
crate fn int(i: impl Into<i64>, span: impl Into<Span>) -> Expression { pub(crate) fn int(i: impl Into<i64>, span: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item(RawExpression::Literal(Literal::Integer(i.into())), span) Tagged::from_simple_spanned_item(RawExpression::Literal(Literal::Integer(i.into())), span)
} }
crate fn size(i: impl Into<i64>, unit: impl Into<Unit>, span: impl Into<Span>) -> Expression { pub(crate) fn size(i: impl Into<i64>, unit: impl Into<Unit>, span: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item( Tagged::from_simple_spanned_item(
RawExpression::Literal(Literal::Size(i.into(), unit.into())), RawExpression::Literal(Literal::Size(i.into(), unit.into())),
span, span,
) )
} }
crate fn synthetic_string(s: impl Into<String>) -> Expression { pub(crate) fn synthetic_string(s: impl Into<String>) -> Expression {
RawExpression::Synthetic(Synthetic::String(s.into())).tagged_unknown() RawExpression::Synthetic(Synthetic::String(s.into())).tagged_unknown()
} }
crate fn string(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression { pub(crate) fn string(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item( Tagged::from_simple_spanned_item(
RawExpression::Literal(Literal::String(inner.into())), RawExpression::Literal(Literal::String(inner.into())),
outer.into(), outer.into(),
) )
} }
crate fn file_path(path: impl Into<PathBuf>, outer: impl Into<Span>) -> Expression { pub(crate) fn file_path(path: impl Into<PathBuf>, outer: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item(RawExpression::FilePath(path.into()), outer.into()) Tagged::from_simple_spanned_item(RawExpression::FilePath(path.into()), outer.into())
} }
crate fn bare(span: impl Into<Span>) -> Expression { pub(crate) fn bare(span: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item(RawExpression::Literal(Literal::Bare), span.into()) Tagged::from_simple_spanned_item(RawExpression::Literal(Literal::Bare), span.into())
} }
crate fn variable(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression { pub(crate) fn variable(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item( Tagged::from_simple_spanned_item(
RawExpression::Variable(Variable::Other(inner.into())), RawExpression::Variable(Variable::Other(inner.into())),
outer.into(), outer.into(),
) )
} }
crate fn external_command(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression { pub(crate) fn external_command(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item( Tagged::from_simple_spanned_item(
RawExpression::ExternalCommand(ExternalCommand::new(inner.into())), RawExpression::ExternalCommand(ExternalCommand::new(inner.into())),
outer.into(), outer.into(),
) )
} }
crate fn it_variable(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression { pub(crate) fn it_variable(inner: impl Into<Span>, outer: impl Into<Span>) -> Expression {
Tagged::from_simple_spanned_item( Tagged::from_simple_spanned_item(
RawExpression::Variable(Variable::It(inner.into())), RawExpression::Variable(Variable::It(inner.into())),
outer.into(), outer.into(),

View File

@ -19,7 +19,7 @@ pub enum NamedValue {
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, new)] #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, new)]
pub struct NamedArguments { pub struct NamedArguments {
#[new(default)] #[new(default)]
crate named: IndexMap<String, NamedValue>, pub(crate) named: IndexMap<String, NamedValue>,
} }
impl ToDebug for NamedArguments { impl ToDebug for NamedArguments {

View File

@ -1,12 +1,12 @@
crate mod call_node; pub(crate) mod call_node;
crate mod files; pub(crate) mod files;
crate mod flag; pub(crate) mod flag;
crate mod operator; pub(crate) mod operator;
crate mod parser; pub(crate) mod parser;
crate mod pipeline; pub(crate) mod pipeline;
crate mod text; pub(crate) mod text;
crate mod token_tree; pub(crate) mod token_tree;
crate mod token_tree_builder; pub(crate) mod token_tree_builder;
crate mod tokens; pub(crate) mod tokens;
crate mod unit; pub(crate) mod unit;
crate mod util; pub(crate) mod util;

View File

@ -5,8 +5,8 @@ use getset::Getters;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, new)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, new)]
pub struct Pipeline { pub struct Pipeline {
crate parts: Vec<PipelineElement>, pub(crate) parts: Vec<PipelineElement>,
crate post_ws: Option<Span>, pub(crate) post_ws: Option<Span>,
} }
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Getters, new)] #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Getters, new)]

View File

@ -157,7 +157,7 @@ impl TokenNode {
} }
} }
crate fn as_flag(&self, value: &str, source: &Text) -> Option<Tagged<Flag>> { pub(crate) fn as_flag(&self, value: &str, source: &Text) -> Option<Tagged<Flag>> {
match self { match self {
TokenNode::Flag( TokenNode::Flag(
flag @ Tagged { flag @ Tagged {

View File

@ -24,7 +24,7 @@ impl Unit {
} }
} }
crate fn compute(&self, size: i64) -> Value { pub(crate) fn compute(&self, size: i64) -> Value {
Value::int(match self { Value::int(match self {
Unit::B => size, Unit::B => size,
Unit::KB => size * 1024, Unit::KB => size * 1024,

View File

@ -1,5 +1,5 @@
// TODO: Temporary redirect // TODO: Temporary redirect
crate use crate::context::CommandRegistry; pub(crate) use crate::context::CommandRegistry;
use crate::evaluate::{evaluate_baseline_expr, Scope}; use crate::evaluate::{evaluate_baseline_expr, Scope};
use crate::parser::{hir, hir::SyntaxType, parse_command, CallNode}; use crate::parser::{hir, hir::SyntaxType, parse_command, CallNode};
use crate::prelude::*; use crate::prelude::*;
@ -46,7 +46,7 @@ impl PositionalType {
} }
#[allow(unused)] #[allow(unused)]
crate fn to_coerce_hint(&self) -> Option<SyntaxType> { pub(crate) fn to_coerce_hint(&self) -> Option<SyntaxType> {
match self { match self {
PositionalType::Mandatory(_, SyntaxType::Block) PositionalType::Mandatory(_, SyntaxType::Block)
| PositionalType::Optional(_, SyntaxType::Block) => Some(SyntaxType::Block), | PositionalType::Optional(_, SyntaxType::Block) => Some(SyntaxType::Block),
@ -54,14 +54,14 @@ impl PositionalType {
} }
} }
crate fn name(&self) -> &str { pub(crate) fn name(&self) -> &str {
match self { match self {
PositionalType::Mandatory(s, _) => s, PositionalType::Mandatory(s, _) => s,
PositionalType::Optional(s, _) => s, PositionalType::Optional(s, _) => s,
} }
} }
crate fn syntax_type(&self) -> SyntaxType { pub(crate) fn syntax_type(&self) -> SyntaxType {
match *self { match *self {
PositionalType::Mandatory(_, t) => t, PositionalType::Mandatory(_, t) => t,
PositionalType::Optional(_, t) => t, PositionalType::Optional(_, t) => t,
@ -276,7 +276,7 @@ impl Iterator for PositionalIter<'a> {
} }
impl Signature { impl Signature {
crate fn parse_args( pub(crate) fn parse_args(
&self, &self,
call: &Tagged<CallNode>, call: &Tagged<CallNode>,
context: &Context, context: &Context,
@ -290,12 +290,12 @@ impl Signature {
} }
#[allow(unused)] #[allow(unused)]
crate fn signature(&self) -> String { pub(crate) fn signature(&self) -> String {
format!("TODO") format!("TODO")
} }
} }
crate fn evaluate_args( pub(crate) fn evaluate_args(
call: &hir::Call, call: &hir::Call,
registry: &CommandRegistry, registry: &CommandRegistry,
scope: &Scope, scope: &Scope,

View File

@ -47,37 +47,37 @@ macro_rules! trace_out_stream {
}}; }};
} }
crate use crate::cli::MaybeOwned; pub(crate) use crate::cli::MaybeOwned;
crate use crate::commands::command::{ pub(crate) use crate::commands::command::{
CallInfo, CommandAction, CommandArgs, ReturnSuccess, ReturnValue, RunnableContext, CallInfo, CommandAction, CommandArgs, ReturnSuccess, ReturnValue, RunnableContext,
}; };
crate use crate::commands::PerItemCommand; pub(crate) use crate::commands::PerItemCommand;
crate use crate::context::CommandRegistry; pub(crate) use crate::context::CommandRegistry;
crate use crate::context::{Context, SpanSource}; pub(crate) use crate::context::{Context, SpanSource};
crate use crate::env::host::handle_unexpected; pub(crate) use crate::env::host::handle_unexpected;
crate use crate::env::Host; pub(crate) use crate::env::Host;
crate use crate::errors::ShellError; pub(crate) use crate::errors::ShellError;
crate use crate::object::base as value; pub(crate) use crate::object::base as value;
crate use crate::object::meta::{Tag, Tagged, TaggedItem}; pub(crate) use crate::object::meta::{Tag, Tagged, TaggedItem};
crate use crate::object::types::ExtractType; pub(crate) use crate::object::types::ExtractType;
crate use crate::object::{Primitive, Value}; pub(crate) use crate::object::{Primitive, Value};
crate use crate::parser::hir::SyntaxType; pub(crate) use crate::parser::hir::SyntaxType;
crate use crate::parser::registry::Signature; pub(crate) use crate::parser::registry::Signature;
crate use crate::shell::filesystem_shell::FilesystemShell; pub(crate) use crate::shell::filesystem_shell::FilesystemShell;
crate use crate::shell::shell_manager::ShellManager; pub(crate) use crate::shell::shell_manager::ShellManager;
crate use crate::shell::value_shell::ValueShell; pub(crate) use crate::shell::value_shell::ValueShell;
crate use crate::stream::{InputStream, OutputStream}; pub(crate) use crate::stream::{InputStream, OutputStream};
crate use crate::traits::{HasSpan, ToDebug}; pub(crate) use crate::traits::{HasSpan, ToDebug};
crate use crate::Span; pub(crate) use crate::Span;
crate use crate::Text; pub(crate) use crate::Text;
crate use futures::stream::BoxStream; pub(crate) use futures::stream::BoxStream;
crate use futures::{FutureExt, Stream, StreamExt}; pub(crate) use futures::{FutureExt, Stream, StreamExt};
crate use futures_async_stream::async_stream_block; pub(crate) use futures_async_stream::async_stream_block;
#[allow(unused)] #[allow(unused)]
crate use serde::{Deserialize, Serialize}; pub(crate) use serde::{Deserialize, Serialize};
crate use std::collections::VecDeque; pub(crate) use std::collections::VecDeque;
crate use std::future::Future; pub(crate) use std::future::Future;
crate use std::sync::{Arc, Mutex}; pub(crate) use std::sync::{Arc, Mutex};
pub trait FromInputStream { pub trait FromInputStream {
fn from_input_stream(self) -> OutputStream; fn from_input_stream(self) -> OutputStream;

View File

@ -1,8 +1,8 @@
crate mod completer; pub(crate) mod completer;
crate mod filesystem_shell; pub(crate) mod filesystem_shell;
crate mod helper; pub(crate) mod helper;
crate mod shell; pub(crate) mod shell;
crate mod shell_manager; pub(crate) mod shell_manager;
crate mod value_shell; pub(crate) mod value_shell;
crate use helper::Helper; pub(crate) use helper::Helper;

View File

@ -3,7 +3,7 @@ use derive_new::new;
use rustyline::completion::{Completer, FilenameCompleter}; use rustyline::completion::{Completer, FilenameCompleter};
#[derive(new)] #[derive(new)]
crate struct NuCompleter { pub(crate) struct NuCompleter {
pub file_completer: FilenameCompleter, pub file_completer: FilenameCompleter,
pub commands: CommandRegistry, pub commands: CommandRegistry,
} }

View File

@ -14,7 +14,7 @@ use rustyline::hint::{Hinter, HistoryHinter};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
pub struct FilesystemShell { pub struct FilesystemShell {
crate path: String, pub(crate) path: String,
completer: NuCompleter, completer: NuCompleter,
hinter: HistoryHinter, hinter: HistoryHinter,
} }

View File

@ -11,12 +11,12 @@ use rustyline::highlight::Highlighter;
use rustyline::hint::Hinter; use rustyline::hint::Hinter;
use std::borrow::Cow::{self, Owned}; use std::borrow::Cow::{self, Owned};
crate struct Helper { pub(crate) struct Helper {
helper: ShellManager, helper: ShellManager,
} }
impl Helper { impl Helper {
crate fn new(helper: ShellManager) -> Helper { pub(crate) fn new(helper: ShellManager) -> Helper {
Helper { helper } Helper { helper }
} }
} }

View File

@ -14,8 +14,8 @@ use std::sync::{Arc, Mutex};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ShellManager { pub struct ShellManager {
crate current_shell: usize, pub(crate) current_shell: usize,
crate shells: Arc<Mutex<Vec<Box<dyn Shell + Send>>>>, pub(crate) shells: Arc<Mutex<Vec<Box<dyn Shell + Send>>>>,
} }
impl ShellManager { impl ShellManager {

View File

@ -11,8 +11,8 @@ use std::path::PathBuf;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ValueShell { pub struct ValueShell {
crate path: String, pub(crate) path: String,
crate value: Tagged<Value>, pub(crate) value: Tagged<Value>,
} }
impl ValueShell { impl ValueShell {

View File

@ -1,7 +1,7 @@
use crate::prelude::*; use crate::prelude::*;
pub struct InputStream { pub struct InputStream {
crate values: BoxStream<'static, Tagged<Value>>, pub(crate) values: BoxStream<'static, Tagged<Value>>,
} }
impl InputStream { impl InputStream {
@ -49,7 +49,7 @@ impl From<Vec<Tagged<Value>>> for InputStream {
} }
pub struct OutputStream { pub struct OutputStream {
crate values: BoxStream<'static, ReturnValue>, pub(crate) values: BoxStream<'static, ReturnValue>,
} }
impl OutputStream { impl OutputStream {