mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:05:27 +02:00
SyntaxShape checking in Alias (#2377)
* initial, working for shallow internals * add recurion on Block * clean up/abstract, Invocations * use Result * inspection of Binary, tests * improve code structure * move arg shape inspection to Alias command * add spanned errors, tests, cleanup for PR * fix test, clippy
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use crate::hir::Block;
|
||||
use crate::value::Value;
|
||||
use crate::SyntaxShape;
|
||||
use nu_errors::ShellError;
|
||||
use nu_source::{b, DebugDocBuilder, PrettyDebug};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -22,7 +23,7 @@ pub enum CommandAction {
|
||||
/// Enter the help shell, which allows exploring the help system
|
||||
EnterHelpShell(Value),
|
||||
/// Enter the help shell, which allows exploring the help system
|
||||
AddAlias(String, Vec<String>, Block),
|
||||
AddAlias(String, Vec<(String, SyntaxShape)>, Block),
|
||||
/// Go to the previous shell in the shell ring buffer
|
||||
PreviousShell,
|
||||
/// Go to the next shell in the shell ring buffer
|
||||
|
@ -2,7 +2,7 @@ use nu_source::{b, DebugDocBuilder, PrettyDebug};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The syntactic shapes that values must match to be passed into a command. You can think of this as the type-checking that occurs when you call a function.
|
||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub enum SyntaxShape {
|
||||
/// Any syntactic form is allowed
|
||||
Any,
|
||||
|
Reference in New Issue
Block a user