Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions resources/filecontent/filecontent.dsc.resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@
],
"return": "state"
},
"export": {
"executable": "filecontent",
"args": [
"export",
{
"jsonInputArg": "--input",
"mandatory": true
}
],
"supportsFiltering": false
},
"exitCodes": {
"0": "Success",
"1": "Invalid arguments",
Expand Down
4 changes: 2 additions & 2 deletions resources/filecontent/locales/en-us.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
_version = 1

[main]
missingOperation = "Missing operation. Usage: filecontent <get|set|test|export> --input <json>"
unknownOperation = "Unknown operation: '%{operation}'. Expected: get, set, test, or export"
missingOperation = "Missing operation. Usage: filecontent <get|set|test> --input <json>"
unknownOperation = "Unknown operation: '%{operation}'. Expected: get, set, or test"
missingInput = "Missing --input argument"
missingInputValue = "Missing value for --input argument"
invalidJson = "Invalid JSON input: %{error}"
Expand Down
5 changes: 0 additions & 5 deletions resources/filecontent/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ pub fn test(input: &FileContent) -> Result<FileContent, String> {
Ok(actual)
}

pub fn export(input: &FileContent) -> Result<FileContent, String> {
validate_input(input)?;
read_state(&input.path)
}

#[derive(Clone, Copy)]
enum HashAlgorithm {
Sha256,
Expand Down
3 changes: 1 addition & 2 deletions resources/filecontent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mod file;
mod types;

use crate::file::{export, get, set, test};
use crate::file::{get, set, test};
Comment thread
SteveL-MSFT marked this conversation as resolved.
use crate::types::FileContent;
use rust_i18n::t;
use serde::Serialize;
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions resources/filecontent/tests/filecontent_export.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down