New-CatProject
Creates a new project folder from a template — a project file and, depending on the template, sample data, a read-me and a run script.
On this page
Synopsis
New-CatProject [[-Name] <string>] [[-Path] <string>] [-Template <string>] [-Online] [-Commented] [-Force] [-Wrap] [-LoggingLevel <string>]
Parameters
| Parameter | Type | Position | Default | Meaning |
|---|---|---|---|---|
-Name |
string | 0 | TestMyData |
Name of the project; becomes the project file name (.cat.yaml is appended when missing) and, with -Wrap, the folder name. Alias -ProjectName. |
-Path |
string | 1 | current location | Where to create the files. Must exist. Alias -Directory. |
-Template |
string | named | default |
Template code — see Get-CatProjectTemplate. |
-Online |
switch | named | off | First fetch the template from the CAT server if a newer version exists there. Without it, CAT never goes online. |
-Commented |
switch | named | off | Use the commented variant of the template’s project file — every setting explained inline. |
-Force |
switch | named | off | Delete everything in the target folder first. The target is -Path itself unless -Wrap is given, so -Force without -Wrap empties the directory you point it at. |
-Wrap |
switch | named | off | Create a sub-folder named after the project inside -Path and put everything there. |
-LoggingLevel |
string | named | — | Accepted but ignored in the current version; the session is created at Information (or reused). |
What it does
Copies the template’s files into the target folder, keeps the plain or the commented project file according to -Commented, renames it to <Name>.cat.yaml and replaces the project-name placeholder in every file. Two templates ship with CAT: default — one simple test against a local SQL Server database, the starting point for a real project — and getStartedWindows — a few tests over two sample CSV files with a read-me and a Run.ps1, the project the Get started tutorial walks through. Get-CatProjectTemplate -Online may show more. A template fetched with -Online is stored under %APPDATA%\CAT\Templates\Projects\ and used from there afterwards.
Without -Force, a target that already holds a file of the same name makes the cmdlet fail with Failed to extract the project template to the target directory. — nothing is overwritten. The cmdlet signs in (or reuses the session) like every project cmdlet, even though it touches no data.
Output
Nothing on the pipeline. The files appear in the target folder; with logging on, the log says where.
Errors
Refusals from the sign-in and plan check are terminating errors with the CatPortal.* ids listed on the Introduction page. …the specified path does not exist: … when -Path does not exist; Cannot create project from template <code>, the template does not exist. for an unknown code; the extraction error above when files are in the way.
Examples
# a lean TestMyData.cat.yaml in the current directory
New-CatProject
# a project of your own: Dwh.cat.yaml in a new folder D:\Testing\Dwh, with inline comments
New-CatProject -Name Dwh -Path 'D:\Testing' -Wrap -Commented
# the tutorial sample, refreshed from the server, in its own folder
New-CatProject -Name CatSampleProject -Path "$HOME\Documents\CAT" -Template getStartedWindows -Wrap -Online
# start the sample over: empties D:\Samples\CatSampleProject first
New-CatProject -Name CatSampleProject -Path 'D:\Samples' -Template getStartedWindows -Wrap -Force
Related
- Introduction — session model, logging, errors, sign-in.
Get-CatProjectTemplate— the template codes.- Project file · How to create a project file.