Unification of the format of our scripts

Issue #22 closed
Denis Kuzmin repo owner created an issue

Need to revise the our format

Currently uses:

  • Definition the dynamic variables - Issue #13
  • Additional variables

Planned:

  • Subcommands
  • Conditions ...

Comments (4)

  1. Denis Kuzmin reporter

    Variant 1

    #[..]  - general container
    ##[..] - escaped
    

    Internal Variables & Functions

    #[<type><space><left operand><token><right operand>]
    &
    #[<type><space><operand>]
    

    Where:

    • type: string ~[A-z0-9_]+) with general operation
    • left operand: subtype to concretization of definition ~ [A-z0-9_.()]+
      • <type1>.<type2>.<type3>
      • <type1>(arg).<type2>.<type3>(arg1, arg2)
    • token - [:, =]
    • right operand: mixed

    Samples:

    #[var test = $(..)]
    #[var test = "string"]
    
    #[DTE exec: <cmd>(<args>)]
    #[Build cancel = true|false|1|0]
    
    #[vsSBE events.<type>.item(<name>/<index>).enabled = false]
    
    #[OWP out(Debug).Warnings]
    #[OWP out]
    
    #[Func getFromFile:/path1/path2/sha1.exe arg1 "arg p2"]
    

    Comments

    #["Comment"]
    

    Conditions

    #[(cond){ body1 }else{ body2 }]
    
    #[($(var)){
       body
    }]
    
    #[($(var) == "expected"){
       body
    }]
    
  2. Denis Kuzmin reporter

    Added new core - SBE-Scripts + Components for this

    see fd99fab & 34cdc43

    Currently components (implementing IComponent<T>):

    • Internal - All internal operation with vsSBE
    • UserVariable - For work with User-Variables
    • Comment - Any supported comments with scripts
    • Condition - Conditions in scripts
    • Function - Mixed supported functions
    • OWP - For work with OWP
    • DTE - For work with DTE
    • File - Support file operations - I/O, call, etc.
    • Build - Components of building

    all the new features should be easy to adding! Welcome for other developers :)

    Simple Component:

    public class DemoComponent: IComponent
    {
        /// <summary>
        /// Type of implementation
        /// </summary>
        public ComponentType Type
        {
            get { return ComponentType.Demo; }
        }
    
        /// <summary>
        /// Handling with current type
        /// </summary>
        /// <param name="data">mixed data</param>
        /// <returns>prepared and evaluated data</returns>
        public string parse(string data)
        {
            //TODO
        }
    }
    

    or with custom result

    public class UserVariableComponent: IComponent<DemoComponentResult>
    {
        public ComponentType Type
        {
            get { return ComponentType.Demo; }
        }
    
        public DemoComponentResult parse(string data)
        {
            //TODO
        }
    }
    
  3. Log in to comment