Add unpack state, command not found errors

This commit is contained in:
garrettmills
2020-03-03 21:06:59 -06:00
parent 9291c52383
commit ec8047361c
6 changed files with 91 additions and 7 deletions

View File

@@ -63,6 +63,16 @@ class UniversalPath extends Injectable {
return path.dirname(this.path)
}
async parent() {
await this.classify()
if ( this.is_directory() ) return path.resolve(this.path, '..')
return this.directory()
}
name() {
return path.basename(this.path)
}
async classify() {
const dir_result = await this._host.execute(`${this._directory_classify_command} ${this._path}`)
if ( dir_result.exit_code === 0 ) {

View File

@@ -0,0 +1,5 @@
class CommandNotFoundError extends Error {
}
module.exports = exports = CommandNotFoundError