Skip to content

Commit 2f6950e

Browse files
committed
Initial commit
0 parents  commit 2f6950e

File tree

11 files changed

+682
-0
lines changed

11 files changed

+682
-0
lines changed

.gitignore

Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
nupkg/
2+
3+
## Ignore Visual Studio temporary files, build results, and
4+
## files generated by popular Visual Studio add-ons.
5+
##
6+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
7+
8+
# User-specific files
9+
*.suo
10+
*.user
11+
*.userosscache
12+
*.sln.docstates
13+
14+
# User-specific files (MonoDevelop/Xamarin Studio)
15+
*.userprefs
16+
17+
# Build results
18+
[Dd]ebug/
19+
[Dd]ebugPublic/
20+
[Rr]elease/
21+
[Rr]eleases/
22+
x64/
23+
x86/
24+
bld/
25+
[Bb]in/
26+
[Oo]bj/
27+
[Ll]og/
28+
29+
# Visual Studio 2015/2017 cache/options directory
30+
.vs/
31+
# Uncomment if you have tasks that create the project's static files in wwwroot
32+
#wwwroot/
33+
34+
# Visual Studio 2017 auto generated files
35+
Generated\ Files/
36+
37+
# MSTest test Results
38+
[Tt]est[Rr]esult*/
39+
[Bb]uild[Ll]og.*
40+
41+
# NUNIT
42+
*.VisualState.xml
43+
TestResult.xml
44+
45+
# Build Results of an ATL Project
46+
[Dd]ebugPS/
47+
[Rr]eleasePS/
48+
dlldata.c
49+
50+
# Benchmark Results
51+
BenchmarkDotNet.Artifacts/
52+
53+
# .NET Core
54+
project.lock.json
55+
project.fragment.lock.json
56+
artifacts/
57+
**/Properties/launchSettings.json
58+
59+
# StyleCop
60+
StyleCopReport.xml
61+
62+
# Files built by Visual Studio
63+
*_i.c
64+
*_p.c
65+
*_i.h
66+
*.ilk
67+
*.meta
68+
*.obj
69+
*.iobj
70+
*.pch
71+
*.pdb
72+
*.ipdb
73+
*.pgc
74+
*.pgd
75+
*.rsp
76+
*.sbr
77+
*.tlb
78+
*.tli
79+
*.tlh
80+
*.tmp
81+
*.tmp_proj
82+
*.log
83+
*.vspscc
84+
*.vssscc
85+
.builds
86+
*.pidb
87+
*.svclog
88+
*.scc
89+
90+
# Chutzpah Test files
91+
_Chutzpah*
92+
93+
# Visual C++ cache files
94+
ipch/
95+
*.aps
96+
*.ncb
97+
*.opendb
98+
*.opensdf
99+
*.sdf
100+
*.cachefile
101+
*.VC.db
102+
*.VC.VC.opendb
103+
104+
# Visual Studio profiler
105+
*.psess
106+
*.vsp
107+
*.vspx
108+
*.sap
109+
110+
# Visual Studio Trace Files
111+
*.e2e
112+
113+
# TFS 2012 Local Workspace
114+
$tf/
115+
116+
# Guidance Automation Toolkit
117+
*.gpState
118+
119+
# ReSharper is a .NET coding add-in
120+
_ReSharper*/
121+
*.[Rr]e[Ss]harper
122+
*.DotSettings.user
123+
124+
# JustCode is a .NET coding add-in
125+
.JustCode
126+
127+
# TeamCity is a build add-in
128+
_TeamCity*
129+
130+
# DotCover is a Code Coverage Tool
131+
*.dotCover
132+
133+
# AxoCover is a Code Coverage Tool
134+
.axoCover/*
135+
!.axoCover/settings.json
136+
137+
# Visual Studio code coverage results
138+
*.coverage
139+
*.coveragexml
140+
141+
# NCrunch
142+
_NCrunch_*
143+
.*crunch*.local.xml
144+
nCrunchTemp_*
145+
146+
# MightyMoose
147+
*.mm.*
148+
AutoTest.Net/
149+
150+
# Web workbench (sass)
151+
.sass-cache/
152+
153+
# Installshield output folder
154+
[Ee]xpress/
155+
156+
# DocProject is a documentation generator add-in
157+
DocProject/buildhelp/
158+
DocProject/Help/*.HxT
159+
DocProject/Help/*.HxC
160+
DocProject/Help/*.hhc
161+
DocProject/Help/*.hhk
162+
DocProject/Help/*.hhp
163+
DocProject/Help/Html2
164+
DocProject/Help/html
165+
166+
# Click-Once directory
167+
publish/
168+
169+
# Publish Web Output
170+
*.[Pp]ublish.xml
171+
*.azurePubxml
172+
# Note: Comment the next line if you want to checkin your web deploy settings,
173+
# but database connection strings (with potential passwords) will be unencrypted
174+
*.pubxml
175+
*.publishproj
176+
177+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
178+
# checkin your Azure Web App publish settings, but sensitive information contained
179+
# in these scripts will be unencrypted
180+
PublishScripts/
181+
182+
# NuGet Packages
183+
*.nupkg
184+
# The packages folder can be ignored because of Package Restore
185+
**/[Pp]ackages/*
186+
# except build/, which is used as an MSBuild target.
187+
!**/[Pp]ackages/build/
188+
# Uncomment if necessary however generally it will be regenerated when needed
189+
#!**/[Pp]ackages/repositories.config
190+
# NuGet v3's project.json files produces more ignorable files
191+
*.nuget.props
192+
*.nuget.targets
193+
194+
# Microsoft Azure Build Output
195+
csx/
196+
*.build.csdef
197+
198+
# Microsoft Azure Emulator
199+
ecf/
200+
rcf/
201+
202+
# Windows Store app package directories and files
203+
AppPackages/
204+
BundleArtifacts/
205+
Package.StoreAssociation.xml
206+
_pkginfo.txt
207+
*.appx
208+
209+
# Visual Studio cache files
210+
# files ending in .cache can be ignored
211+
*.[Cc]ache
212+
# but keep track of directories ending in .cache
213+
!*.[Cc]ache/
214+
215+
# Others
216+
ClientBin/
217+
~$*
218+
*~
219+
*.dbmdl
220+
*.dbproj.schemaview
221+
*.jfm
222+
*.pfx
223+
*.publishsettings
224+
orleans.codegen.cs
225+
226+
# Including strong name files can present a security risk
227+
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
228+
#*.snk
229+
230+
# Since there are multiple workflows, uncomment next line to ignore bower_components
231+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
232+
#bower_components/
233+
234+
# RIA/Silverlight projects
235+
Generated_Code/
236+
237+
# Backup & report files from converting an old project file
238+
# to a newer Visual Studio version. Backup files are not needed,
239+
# because we have git ;-)
240+
_UpgradeReport_Files/
241+
Backup*/
242+
UpgradeLog*.XML
243+
UpgradeLog*.htm
244+
ServiceFabricBackup/
245+
*.rptproj.bak
246+
247+
# SQL Server files
248+
*.mdf
249+
*.ldf
250+
*.ndf
251+
252+
# Business Intelligence projects
253+
*.rdl.data
254+
*.bim.layout
255+
*.bim_*.settings
256+
*.rptproj.rsuser
257+
258+
# Microsoft Fakes
259+
FakesAssemblies/
260+
261+
# GhostDoc plugin setting file
262+
*.GhostDoc.xml
263+
264+
# Node.js Tools for Visual Studio
265+
.ntvs_analysis.dat
266+
node_modules/
267+
268+
# Visual Studio 6 build log
269+
*.plg
270+
271+
# Visual Studio 6 workspace options file
272+
*.opt
273+
274+
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
275+
*.vbw
276+
277+
# Visual Studio LightSwitch build output
278+
**/*.HTMLClient/GeneratedArtifacts
279+
**/*.DesktopClient/GeneratedArtifacts
280+
**/*.DesktopClient/ModelManifest.xml
281+
**/*.Server/GeneratedArtifacts
282+
**/*.Server/ModelManifest.xml
283+
_Pvt_Extensions
284+
285+
# Paket dependency manager
286+
.paket/paket.exe
287+
paket-files/
288+
289+
# FAKE - F# Make
290+
.fake/
291+
292+
# JetBrains Rider
293+
.idea/
294+
*.sln.iml
295+
296+
# CodeRush
297+
.cr/
298+
299+
# Python Tools for Visual Studio (PTVS)
300+
__pycache__/
301+
*.pyc
302+
303+
# Cake - Uncomment if you are using it
304+
# tools/**
305+
# !tools/packages.config
306+
307+
# Tabs Studio
308+
*.tss
309+
310+
# Telerik's JustMock configuration file
311+
*.jmconfig
312+
313+
# BizTalk build output
314+
*.btp.cs
315+
*.btm.cs
316+
*.odx.cs
317+
*.xsd.cs
318+
319+
# OpenCover UI analysis results
320+
OpenCover/
321+
322+
# Azure Stream Analytics local run output
323+
ASALocalRun/
324+
325+
# MSBuild Binary and Structured Log
326+
*.binlog
327+
328+
# NVidia Nsight GPU debugger configuration file
329+
*.nvuser
330+
331+
# MFractors (Xamarin productivity tool) working folder
332+
.mfractor/

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## dotnet-json
2+
3+
`dotnet-json` is a .NET Core 3.1 global tool for manipulation JSON files.
4+
5+
Install `dotnet-json` with `dotnet tool install -g dotnet-json`
6+
7+
### Commands
8+
9+
#### Merge
10+
11+
`dotnet-json` can merge one or more .json files into a main file:
12+
13+
`dotnet json merge <main> <merge>...`
14+
15+
The merge result is written to the `<main>` file.
16+
17+
18+
#### Set
19+
20+
Use `dotnet json set <file.json> <key> <value>` to set a single value in a json file.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Collections.Generic;
2+
using dotnet_json.Commands;
3+
using Newtonsoft.Json.Linq;
4+
using Xunit;
5+
6+
namespace dotnet_json.Tests.Commands
7+
{
8+
public class MergeCommandTests
9+
{
10+
private MergeCommand _command;
11+
12+
public MergeCommandTests()
13+
{
14+
_command = new MergeCommand();
15+
}
16+
17+
[Theory]
18+
[MemberData(nameof(ValuesMatrix))]
19+
public void MergeValue_MergesTwoValueObjects(object main, object merge)
20+
{
21+
var mainValue = new JValue(main);
22+
var mergeValue = new JValue(merge);
23+
24+
_command.MergeValue(mainValue, mergeValue);
25+
26+
Assert.Equal(mainValue.Value, merge);
27+
}
28+
29+
public static IEnumerable<object[]> ValuesMatrix()
30+
{
31+
var values = new object[] { true, false, 1, 2, "test", "tset", null, null };
32+
33+
foreach (var value1 in values)
34+
foreach (var value2 in values)
35+
if (value1 != value2)
36+
yield return new[] { value1, value2 };
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)