added functionality to add file

This commit is contained in:
2022-01-19 01:04:34 +04:00
parent 75b5339095
commit 909f16a4f6
3 changed files with 201 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ func showHelp(output io.Writer) {
"log error Set error log output\n"+
"exit Exit\n"+
"search file Search globally for files using the local search index\n"+
"add file Adds specified file path to the local warehouse and local blockchain\n"+
"\n")
}
@@ -494,6 +495,15 @@ func userCommands(backend *core.Backend, input io.Reader, output io.Writer, term
fmt.Fprintf(output, " Found via keywords %s\n", keywords)
}
case "add file":
fmt.Fprintf(output, "Enter File Path:\n")
filePath, _, terminate := getUserOptionString(reader, terminateSignal)
if terminate {
return
}
// Add the file to the warehouse and the local blockchain
AddFile(backend, filePath, output)
default:
fmt.Fprintf(output, "Unknown command.\n")
}