Resolve check and freshen paths against the manifest's directory (closes #177)
check / check (push) Waiting to run
check / check (push) Waiting to run
Without --base, check and freshen now look for a manifest's files in the directory that holds it, the file named or the one found in a directory argument, instead of the current directory. So `mfer check /media/drive` checks a drive against its own index.mf from anywhere. check of a manifest given by URL still uses the current directory, and --base still overrides, even when it names the current directory. The --base help text of both commands and the README's Tool Examples state the default; the README gains a freshen entry for this, which also names the hidden files and symlinks freshen leaves out by default and the flags that include them. Model: opus-5-5
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -88,3 +89,17 @@ func (mfa *CLIApp) resolveManifestArg(cmd *cli.Command) (string, error) {
|
||||
|
||||
return findManifest(mfa.Fs, ".")
|
||||
}
|
||||
|
||||
// resolveBasePath returns the directory a manifest's paths are resolved
|
||||
// against: the one --base names, or else the directory holding the manifest,
|
||||
// or the current directory for a manifest URL.
|
||||
func resolveBasePath(cmd *cli.Command, manifestPath string) string {
|
||||
switch {
|
||||
case cmd.IsSet(flagBase):
|
||||
return cmd.String(flagBase)
|
||||
case isHTTPURL(manifestPath):
|
||||
return "."
|
||||
default:
|
||||
return filepath.Dir(manifestPath)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user