mirror of
https://git.um-react.app/um/cli.git
synced 2025-11-28 19:53:01 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72ace9fc62 | ||
|
|
074e4f874f | ||
|
|
2bfb5ffddf | ||
|
|
2c9de7c56c |
@@ -12,7 +12,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
@@ -32,7 +31,7 @@ import (
|
|||||||
"unlock-music.dev/cli/internal/utils"
|
"unlock-music.dev/cli/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var AppVersion = "v0.2.9"
|
var AppVersion = "v0.2.11"
|
||||||
|
|
||||||
var logger = setupLogger(false) // TODO: inject logger to application, instead of using global logger
|
var logger = setupLogger(false) // TODO: inject logger to application, instead of using global logger
|
||||||
|
|
||||||
@@ -135,6 +134,11 @@ func appMain(c *cli.Context) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input, absErr := filepath.Abs(input)
|
||||||
|
if absErr != nil {
|
||||||
|
return fmt.Errorf("get abs path failed: %w", absErr)
|
||||||
|
}
|
||||||
|
|
||||||
output := c.String("output")
|
output := c.String("output")
|
||||||
inputStat, err := os.Stat(input)
|
inputStat, err := os.Stat(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -145,13 +149,18 @@ func appMain(c *cli.Context) (err error) {
|
|||||||
if inputStat.IsDir() {
|
if inputStat.IsDir() {
|
||||||
inputDir = input
|
inputDir = input
|
||||||
} else {
|
} else {
|
||||||
inputDir = path.Dir(input)
|
inputDir = filepath.Dir(input)
|
||||||
|
}
|
||||||
|
inputDir, absErr = filepath.Abs(inputDir)
|
||||||
|
if absErr != nil {
|
||||||
|
return fmt.Errorf("get abs path (inputDir) failed: %w", absErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if output == "" {
|
if output == "" {
|
||||||
// Default to where the input dir is
|
// Default to where the input dir is
|
||||||
output = inputDir
|
output = inputDir
|
||||||
}
|
}
|
||||||
|
logger.Debug("resolve input/output path", zap.String("inputDir", inputDir), zap.String("input", input), zap.String("output", output))
|
||||||
|
|
||||||
outputStat, err := os.Stat(output)
|
outputStat, err := os.Stat(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -290,6 +299,8 @@ func (p *processor) processDir(inputDir string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *processor) processFile(filePath string) error {
|
func (p *processor) processFile(filePath string) error {
|
||||||
|
p.logger.Debug("processFile", zap.String("file", filePath), zap.String("inputDir", p.inputDir))
|
||||||
|
|
||||||
allDec := common.GetDecoder(filePath, p.skipNoopDecoder)
|
allDec := common.GetDecoder(filePath, p.skipNoopDecoder)
|
||||||
if len(allDec) == 0 {
|
if len(allDec) == 0 {
|
||||||
return errors.New("skipping while no suitable decoder")
|
return errors.New("skipping while no suitable decoder")
|
||||||
|
|||||||
Reference in New Issue
Block a user