anchor.diff:  :end_args
   
   :: defaults
  +if ["%FNPATH%"]==[""] (
  +  set FNPATH=.
  +) else (
  +  if "%FNPATH:~-1%"=="\" (
  +    set FNPATH=%FNPATH:~0,-1%
  +  )
  +)
   if [%FUNCTION%]==[] (
  -  for %%a in (.) do set FUNCTION=%%~na
  -)
  -if [%FNPATH%]==[] set FNPATH=.
  +  if ["%FNPATH%"]==["."] (
  +    for %%a in (.) do set FUNCTION=%%~na
  +  ) else (
  +    for %%a in ("%FNPATH%") do set FUNCTION=%%~na
  +  )
  +)
   if [%VERSION%]==[] set VERSION=0.0.1
   if [%CONTAINER%]==[] set CONTAINER=sidecar
  +if [%USERACCT%]==[] set USERACCT=%username%
   
   :: execute the commands
   if [%_COMMAND%]==[init] (
  
positive.code: echo Usage:
  echo.
  echo   riff delete -n ^<name^>
  echo.
  echo Options:
  echo.
  echo   -n, --name: the name of the function (defaults to the name of the current directory)
  echo.
  exit /B 0
  
  
negative.code: 
  :: commands
  :init
    :: assume the file extension based on language - might be overridden as necessary later
    if [%FNLANG%]==[] set FNEXT=.sh
    if [%FNLANG%]==[shell] set FNEXT=.sh
    if [%FNLANG%]==[java] set FNEXT=.jar
    if [%FNLANG%]==[node] set FNEXT=.js
    if [%FNLANG%]==[python] set FNEXT=.py
    :: check --file argument
    if exist "%FNPATH%" (
      set _exists=true
    ) else (
      echo "%FNPATH%": No such file or directory
      exit /B 1
    )
    if [%_exists%]==[true] (
      for %%p IN ("%FNPATH%") do if exist %%~sp\nul set FNDIR=%%~sp
    )
    if [%_exists%]==[true] (
      if [%FNDIR%]==[] (
        :: FNPATH is a file
        for /F "delims=" %%i in ("%FNPATH%") do set FNFILE=%%~ni%%~xi
        for /F "delims=" %%i in ("%FNPATH%") do set FNEXT=%%~xi
        for /F "delims=" %%i in ("%FNPATH%") do set FNDIR=%%~dspi
      ) else (
        :: FNPATH is a directory
        if exist %FNDIR%\%FUNCTION%.sh set FNEXT=.sh& set FNFILE=%FUNCTION%.sh
        if exist %FNDIR%\%FUNCTION%.jar set FNEXT=.jar& set FNFILE=%FUNCTION%.jar
        if exist %FNDIR%\%FUNCTION%.js set FNEXT=.js& set FNFILE=%FUNCTION%.js
        if exist %FNDIR%\%FUNCTION%.py set FNEXT=.py& set FNFILE=%FUNCTION%.py
      )
    )
    :: override file path and extension if --artifact provided
    if [%FNARTIFACT%]==[] (
      set ARTRELPATH=%FNFILE%
      set ARTRELDIR=.
      set _artifact=not-set
    ) else (
      set _artifact=false
      if exist %FNARTIFACT% set _artifact=true
    )
    if [%_artifact%]==[true] (
      set _artdir=.
    )
    if [%_artifact%]==[false] (
      if exist %FNDIR%\%FNARTIFACT% (
        set _artifact=true
        set _artdir=%FNDIR%
      )
    )
    if [%_artifact%]==[false] (
        echo Artifact %FNARTIFACT%: No such file
        exit /B 1
    ) 
    if [%_artifact%]==[true] (
      set ARTRELPATH=%FNARTIFACT%
      set ARTRELDIR=%_artdir%
      for /F %%i in ("%FNARTIFACT%") do set FNFILE=%%~ni%%~xi
      for /F %%i in ("%FNARTIFACT%") do set FNEXT=%%~xi
    )
    :: figure out language if not provided in --language arg
    if [%FNLANG%]==[] (
      if "%FNEXT%"==".sh" set FNLANG=shell
      if "%FNEXT%"==".jar" set FNLANG=java
      if "%FNEXT%"==".js" set FNLANG=node
      if "%FNEXT%"==".py" set FNLANG=python
    )
    :: figure out protocol if not provided in --protocol arg
    if [%FNPROT%]==[] (
      if "%FNEXT%"==".sh" set FNPROT=stdio
      if "%FNEXT%"==".jar" set FNPROT=http
      if "%FNEXT%"==".js" set FNPROT=http
      if "%FNEXT%"==".py" set FNPROT=stdio      
    )
    :: default the topic to function name
    if [%TOPIC_IN%]==[] set TOPIC_IN=%FUNCTION%
    :: ready to initialize
    :: but first look for function source
    if exist "%FNDIR%\%FNFILE%" (
      echo Initializing %FNLANG% function %FUNCTION%
    ) else (
      echo Source file %FNFILE% not found, not able to initialize %FNLANG% function %FUNCTION%
      exit /B 1
    )
  
    set FNDOCKER=%FNDIR%\Dockerfile
    call :write_dockerfile
  
    set FNDEF=%FNDIR%\%FUNCTION%-function.yaml
    call :write_func_yaml
  
    set FNTOPICS=%FNDIR%\%FUNCTION%-topics.yaml
    call :write_topics_yaml
  
    exit /B 1
  
  :build
    echo Building %FUNCTION% %FNPATH% %VERSION%
    docker build -t %USERACCT%/%FUNCTION%:%VERSION% %FNPATH%
    if "$DOCKERPUSH"=="true" docker push %USERACCT%/%FUNCTION%:%VERSION%
    exit /B %ERRORLEVEL%
  
  :create
    echo Creating function %FUNCTION% version %VERSION%
    call :init
    set _dir=false
    for %%p IN ("%FNPATH%") do if exist %%~sp\nul set _dir=true
    if "%_dir%"=="false" (
      for /F "delims=" %%i in ("%FNPATH%") do set FNPATH=%%~dspi
    )
    call :build
    call :apply
    exit /B %ERRORLEVEL%
  
  :apply
    echo Applying %FNPATH% resource[s]
  