Feature: cli support uploading image with url

This commit is contained in:
PiEgg 2022-08-26 11:04:44 +08:00
parent 7b50ba7ddb
commit e8489182d7

View File

@ -1,6 +1,7 @@
import path from 'path'
import fs from 'fs-extra'
import { Logger } from 'picgo'
import { isUrl } from '~/universal/utils/common'
interface IResultFileObject {
path: string
}
@ -34,6 +35,11 @@ const getUploadFiles = (argv = process.argv, cwd = process.cwd(), logger: Logger
return null // for uploading images in clipboard
} else if ((fileList?.length || 0) > 0) {
const result = fileList!.map(item => {
if (isUrl(item)) {
return {
path: item
}
}
if (path.isAbsolute(item)) {
return {
path: item