From b2bb6a2da15095b56754b9a34c36daed2beda9c5 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Wed, 16 Sep 2026 16:45:15 -0700 Subject: [PATCH 1/2] Fix export for filecontent resource --- resources/filecontent/filecontent.dsc.resource.json | 11 ----------- resources/filecontent/src/file.rs | 5 ----- resources/filecontent/src/main.rs | 3 +-- .../filecontent/tests/filecontent_export.tests.ps1 | 4 ++-- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/resources/filecontent/filecontent.dsc.resource.json b/resources/filecontent/filecontent.dsc.resource.json index a8ae0de8f..12ba48307 100644 --- a/resources/filecontent/filecontent.dsc.resource.json +++ b/resources/filecontent/filecontent.dsc.resource.json @@ -42,17 +42,6 @@ ], "return": "state" }, - "export": { - "executable": "filecontent", - "args": [ - "export", - { - "jsonInputArg": "--input", - "mandatory": true - } - ], - "supportsFiltering": false - }, "exitCodes": { "0": "Success", "1": "Invalid arguments", diff --git a/resources/filecontent/src/file.rs b/resources/filecontent/src/file.rs index 64745c969..d6a8306b4 100644 --- a/resources/filecontent/src/file.rs +++ b/resources/filecontent/src/file.rs @@ -76,11 +76,6 @@ pub fn test(input: &FileContent) -> Result { Ok(actual) } -pub fn export(input: &FileContent) -> Result { - validate_input(input)?; - read_state(&input.path) -} - #[derive(Clone, Copy)] enum HashAlgorithm { Sha256, diff --git a/resources/filecontent/src/main.rs b/resources/filecontent/src/main.rs index e295a3f96..1f4edef4c 100644 --- a/resources/filecontent/src/main.rs +++ b/resources/filecontent/src/main.rs @@ -4,7 +4,7 @@ mod file; mod types; -use crate::file::{export, get, set, test}; +use crate::file::{get, set, test}; use crate::types::FileContent; use rust_i18n::t; use serde::Serialize; @@ -30,7 +30,6 @@ fn main() { "get" => handle_result(get(&require_input(input))), "set" => handle_result(set(&require_input(input))), "test" => handle_result(test(&require_input(input))), - "export" => handle_result(export(&require_input(input))), _ => fail( EXIT_INVALID_ARGS, &t!("main.unknownOperation", operation = operation), diff --git a/resources/filecontent/tests/filecontent_export.tests.ps1 b/resources/filecontent/tests/filecontent_export.tests.ps1 index 461eabe53..a1948a2ee 100644 --- a/resources/filecontent/tests/filecontent_export.tests.ps1 +++ b/resources/filecontent/tests/filecontent_export.tests.ps1 @@ -13,9 +13,9 @@ Describe 'FileContent export tests' { It 'Returns content and hashes' { $json = @{ path = $filePath } | ConvertTo-Json -Compress - $out = filecontent export --input $json 2>$TestDrive/error.log + $out = dsc resource export -r Microsoft.FileSystem.File/Content --input $json 2>$TestDrive/error.log $LASTEXITCODE | Should -Be 0 -Because (Get-Content -Raw $TestDrive/error.log) - $properties = $out | ConvertFrom-Json + $properties = ($out | ConvertFrom-Json).resources[0].properties $properties.path | Should -BeExactly $filePath $properties.content | Should -BeExactly "hello`nworld" From 509850bde0b1ec7cabd6bdde921100588cd8774c Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Wed, 16 Sep 2026 16:52:33 -0700 Subject: [PATCH 2/2] remove `export` from help --- resources/filecontent/locales/en-us.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/filecontent/locales/en-us.toml b/resources/filecontent/locales/en-us.toml index a51fe5156..c2a3834ae 100644 --- a/resources/filecontent/locales/en-us.toml +++ b/resources/filecontent/locales/en-us.toml @@ -1,8 +1,8 @@ _version = 1 [main] -missingOperation = "Missing operation. Usage: filecontent --input " -unknownOperation = "Unknown operation: '%{operation}'. Expected: get, set, test, or export" +missingOperation = "Missing operation. Usage: filecontent --input " +unknownOperation = "Unknown operation: '%{operation}'. Expected: get, set, or test" missingInput = "Missing --input argument" missingInputValue = "Missing value for --input argument" invalidJson = "Invalid JSON input: %{error}"