Skip to content

Commit

Permalink
Merge pull request #66 from nevermined-io/fix/remove_commits_manually
Browse files Browse the repository at this point in the history
remove unapproved commits
  • Loading branch information
josepablofm78 authored Oct 4, 2022
2 parents 95ce98a + c54a437 commit 51a42aa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nevermined-io/cli",
"version": "0.5.1",
"version": "0.5.0",
"main": "index.js",
"repository": "[email protected]:nevermined-io/cli.git",
"author": "Nevermined",
Expand Down
5 changes: 0 additions & 5 deletions resources/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,6 @@
"type": "number",
"default": "1",
"description": "The page to show"
}, {
"name": "onlyMetadata",
"type": "boolean",
"default": false,
"description": "True if we only want to get metadata"
}]
}, {
"name": "download [did]",
Expand Down
5 changes: 2 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ const cmdHandler = async (
logger
)
if (argv.json) {
logger.mark(executionOutput)
logger.mark(JSON.stringify(executionOutput))
}

if (executionOutput.status > 0) {
logger.error(`Command error: ${executionOutput.errorMessage}`)
}
Expand Down Expand Up @@ -199,4 +198,4 @@ commandsParser.commands.map((_cmd) => {
})
})
})
y.argv
y.argv
26 changes: 5 additions & 21 deletions src/commands/assets/searchAsset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Account, Nevermined } from '@nevermined-io/nevermined-sdk-js'
import { ServiceMetadata } from '@nevermined-io/nevermined-sdk-js/dist/node/ddo/Service'
import { StatusCodes, printSearchResult } from '../../utils'
import chalk from 'chalk'
import { Logger } from 'log4js'
Expand All @@ -13,31 +12,16 @@ export const searchAsset = async (
config: ConfigEntry,
logger: Logger
): Promise<ExecutionOutput> => {
const { verbose, network, query, json, onlyMetadata } = argv
const { verbose, network, query } = argv

logger.info(chalk.dim(`Search using query: ${query}`))

const queryResults = await nvm.assets.search(query, argv.offset, argv.page)
let metadataResult
const assets = await nvm.assets.search(query, argv.offset, argv.page)

if (onlyMetadata) {
metadataResult = {
page: queryResults.page,
totalPages: queryResults.page,
totalResults: queryResults.totalResults,
results: queryResults.results.map((ddo)=> {
const service: ServiceMetadata = ddo.findServiceByType('metadata') as ServiceMetadata
service.attributes.encryptedFiles = ""
return service
})
}
}

if (!json)
printSearchResult(queryResults, logger)
printSearchResult(assets, logger)

return {
status: StatusCodes.OK,
results: onlyMetadata?JSON.stringify(metadataResult):JSON.stringify(queryResults)
results: JSON.stringify(assets)
}
}
}

0 comments on commit 51a42aa

Please sign in to comment.