PowerShell-Yayaml
所属分类:其他
开发工具:PowerShell
文件大小:0KB
下载次数:0
上传日期:2023-08-02 23:18:38
上 传 者:
sh-1993
说明: 使用程序集加载上下文的PowerShell 7+的YAML分析器和编写器。,
(A YAML parser and writer for PowerShell 7+ that uses an Assembly Load Context.,)
文件列表:
.vscode/ (0, 2023-11-28)
.vscode/extensions.json (266, 2023-11-28)
.vscode/launch.json (1133, 2023-11-28)
.vscode/settings.json (1082, 2023-11-28)
.vscode/tasks.json (1467, 2023-11-28)
CHANGELOG.md (1206, 2023-11-28)
LICENSE (1091, 2023-11-28)
PowerShell-Yayaml.sln (1935, 2023-11-28)
ScriptAnalyzerSettings.psd1 (1257, 2023-11-28)
Yayaml.build.ps1 (8407, 2023-11-28)
build.ps1 (2433, 2023-11-28)
docs/ (0, 2023-11-28)
docs/en-US/ (0, 2023-11-28)
docs/en-US/Add-YamlFormat.md (4913, 2023-11-28)
docs/en-US/ConvertFrom-Yaml.md (5664, 2023-11-28)
docs/en-US/ConvertTo-Yaml.md (6990, 2023-11-28)
docs/en-US/New-YamlSchema.md (16514, 2023-11-28)
docs/en-US/Yayaml.md (632, 2023-11-28)
docs/en-US/about_YamlEmitting.md (3777, 2023-11-28)
docs/en-US/about_YamlParsing.md (6039, 2023-11-28)
module/ (0, 2023-11-28)
module/Yayaml.psd1 (4352, 2023-11-28)
module/Yayaml.psm1 (2406, 2023-11-28)
requirements-dev.psd1 (139, 2023-11-28)
src/ (0, 2023-11-28)
src/Yayaml.Module/ (0, 2023-11-28)
src/Yayaml.Module/AddYamlFormat.cs (955, 2023-11-28)
src/Yayaml.Module/ConvertFromYaml.cs (5870, 2023-11-28)
src/Yayaml.Module/ConvertToYaml.cs (9714, 2023-11-28)
src/Yayaml.Module/NewYamlSchema.cs (1933, 2023-11-28)
src/Yayaml.Module/ParameterHelpers.cs (2190, 2023-11-28)
src/Yayaml.Module/ReflectionHelper.cs (3200, 2023-11-28)
src/Yayaml.Module/Yayaml.Module.csproj (998, 2023-11-28)
src/Yayaml/ (0, 2023-11-28)
... ...
# PowerShell-Yayaml
[![Test workflow](https://github.com/jborean93/PowerShell-Yayaml/workflows/Test%20Yayaml/badge.svg)](https://github.com/jborean93/PowerShell-Yayaml/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/jborean93/PowerShell-Yayaml/branch/main/graph/badge.svg?token=b51IOhpLfQ)](https://codecov.io/gh/jborean93/PowerShell-Yayaml)
[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/Yayaml.svg)](https://www.powershellgallery.com/packages/Yayaml)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jborean93/PowerShell-Yayaml/blob/main/LICENSE)
Yet Another YAML PowerShell parser and writer.
While there are a few other YAML modules out on the gallery this module includes the following features:
+ YAML 1.2 parser and emitter
+ YAML 1.2 JSON parser and emitter
+ Support for custom schemas
+ Finer control over scalar, map, and sequence styles
+ Loads `YamlDotNet` in an Assembly Load Context to avoid DLL hell and cross assembly conflicts (PowerShell 7+ only)
There are schemas that support YAML 1.2 (default), 1.2 JSON, 1.1, and failsafe values.
See [Yayaml index](docs/en-US/Yayaml.md) for more details.
## Requirements
These cmdlets have the following requirements
* PowerShell v5.1 or newer
## Examples
Creating a YAML string is as simple as providing an object to serialize:
```powerhell
$obj = [PSCustomObject]@{
Key = 'value'
Testing = 1, 2, 3
}
$obj | ConvertTo-Yaml
```
Produces
```yaml
Key: value
Testing:
- 1
- 2
- 3
```
Parsing a YAML string to an object:
```powershell
$obj = $yaml | ConvertFrom-Yaml
$obj.Key
$obj.Testing
```
The behaviour of these two cmdlets try to follow the `ConvertTo-Json` and `ConvertFrom-Json` cmdlets.
## Installing
The easiest way to install this module is through [PowerShellGet](https://docs.microsoft.com/en-us/powershell/gallery/overview).
You can install this module by running;
```powershell
# Install for only the current user
Install-Module -Name Yayaml -Scope CurrentUser
# Install for all users
Install-Module -Name Yayaml -Scope AllUsers
```
## Contributing
Contributing is quite easy, fork this repo and submit a pull request with the changes.
To build this module run `.\build.ps1 -Task Build` in PowerShell.
To test a build run `.\build.ps1 -Task Test` in PowerShell.
This script will ensure all dependencies are installed before running the test suite.
近期下载者:
相关文件:
收藏者: