最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

telosys -c command is not availabe in version 4.2.0 - Stack Overflow

programmeradmin1浏览0评论

I have created a generate.ps1 file that is doing json to .entity convertion. Then executing telosys gen command with some parameters.

param (
    [string]$JsonPath = "Model-Json\*.json",
    [string]$ModelFolder = "TelosysTools\models\product-model"
)

# Convert all matching JSONs to .entity files
$entities = Get-ChildItem $JsonPath | ForEach-Object {
    .\Convert-JsonToEntity.ps1 -JsonPath $_.FullName -ModelFolder $ModelFolder
    [System.IO.Path]::GetFileNameWithoutExtension($_.FullName)
}

# Build gen command for all converted entities
$genArgs = "gen " + ($entities -join " ") + " * -ifnew"
if (-not $entities) {
    Write-Host "No entities to generate."
    exit 0
}

# Run Telosys generation with full path
$command = "m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q"
cmd.exe /c "D:\setups\telosys-cli-4.2.0-001\tt.bat -h . -c `"$command`""

# Show results
dir Controllers,Models,Services,Repositories,UnitOfWork -File -Recurse

I have tried following three ways to make it work, but it just lands in telosys interactive mode. "-h ." is working but not -c. Telosys docs has not mention c command. Is there any way to run telosys command through generate.ps1?

# Run Telosys generation with full path
$telosysPath = "D:\setups\telosys-cli-4.2.0-001\tt.bat"
$command = "& '$telosysPath' -h . -c `"m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q`""
Invoke-Expression $command

# Run Telosys generation with full path
$telosysPath = "D:\setups\telosys-cli-4.2.0-001\tt.bat"
$command = "m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q"
Write-Host "Running: $telosysPath -h . -c `"$command`""
cmd.exe /c "$telosysPath -h . -c `"$command`""


# Run Telosys generation with full path
$command = "m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q"
cmd.exe /c "D:\setups\telosys-cli-4.2.0-001\tt.bat -h . -c `"$command`""

I have created a generate.ps1 file that is doing json to .entity convertion. Then executing telosys gen command with some parameters.

param (
    [string]$JsonPath = "Model-Json\*.json",
    [string]$ModelFolder = "TelosysTools\models\product-model"
)

# Convert all matching JSONs to .entity files
$entities = Get-ChildItem $JsonPath | ForEach-Object {
    .\Convert-JsonToEntity.ps1 -JsonPath $_.FullName -ModelFolder $ModelFolder
    [System.IO.Path]::GetFileNameWithoutExtension($_.FullName)
}

# Build gen command for all converted entities
$genArgs = "gen " + ($entities -join " ") + " * -ifnew"
if (-not $entities) {
    Write-Host "No entities to generate."
    exit 0
}

# Run Telosys generation with full path
$command = "m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q"
cmd.exe /c "D:\setups\telosys-cli-4.2.0-001\tt.bat -h . -c `"$command`""

# Show results
dir Controllers,Models,Services,Repositories,UnitOfWork -File -Recurse

I have tried following three ways to make it work, but it just lands in telosys interactive mode. "-h ." is working but not -c. Telosys docs has not mention c command. Is there any way to run telosys command through generate.ps1?

# Run Telosys generation with full path
$telosysPath = "D:\setups\telosys-cli-4.2.0-001\tt.bat"
$command = "& '$telosysPath' -h . -c `"m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q`""
Invoke-Expression $command

# Run Telosys generation with full path
$telosysPath = "D:\setups\telosys-cli-4.2.0-001\tt.bat"
$command = "m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q"
Write-Host "Running: $telosysPath -h . -c `"$command`""
cmd.exe /c "$telosysPath -h . -c `"$command`""


# Run Telosys generation with full path
$command = "m $(Split-Path $ModelFolder -Leaf);b csharp-bundle;$genArgs;q"
cmd.exe /c "D:\setups\telosys-cli-4.2.0-001\tt.bat -h . -c `"$command`""
Share Improve this question asked Mar 26 at 8:45 saibinsaibin 254 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

In version 4.2.0 you can simply use "> telosys -i fileName" ( -i for "input file" )
The file is just a text file, it's generally more convenient than single commands
In your file you can define multiple commands ( 1 per line )
and use "exit" as the last command to quit telosys

Basic commands file example:
ver
h
exit

You can also set the "home-dir" with "-h" on the command line :
> telosys -h . -i telosys-cmd.txt

And get the output in another file with the standard ">":
>telosys -h . -i telosys-cmd.txt > foo.txt

By the way, you can load a JSON file in memory using a template and get JSON data
using "dot notation" like "$json.data.firstName"
See this template example:
https://github/telosys-templates/text-files-usage/blob/master/json-from-file.vm
this might be useful to you if you want to generate an ".entity" file from a JSON file using a template

发布评论

评论列表(0)

  1. 暂无评论