detect

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: GPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultRepoURL = "https://p3m.dev/cran/latest"

Variables

This section is empty.

Functions

func AppMode

func AppMode(dir string) string

AppMode infers the application mode from directory contents.

func DefaultRepositories

func DefaultRepositories() []manifest.Repository

DefaultRepositories returns the default repository list.

func DirExists

func DirExists(path string) bool

DirExists checks if a path is a directory.

func Entrypoint

func Entrypoint(dir string) string

Entrypoint returns the primary entrypoint file name.

func FileChecksums

func FileChecksums(dir string) map[string]manifest.FileInfo

FileChecksums walks the directory and computes SHA-256 checksums for all regular files, skipping hidden files and renv artifacts.

func FileExists

func FileExists(path string) bool

FileExists checks if a path is a regular file.

Types

type InputCase

type InputCase int

InputCase represents how the app's dependencies are specified.

const (
	CaseManifest    InputCase = iota // 1a: manifest.json exists
	CaseRenvLock                     // 1b: renv.lock exists
	CasePinFlag                      // 1c: --pin, need R + renv
	CaseDescription                  // 2a: DESCRIPTION exists
	CaseBareScripts                  // 2b: bare scripts only
)

func (InputCase) String

func (c InputCase) String() string

type Result

type Result struct {
	// Which input case was detected.
	InputCase InputCase
	// App name (directory basename).
	Name string
	// App mode (shiny).
	Mode string
	// Entrypoint file.
	Entrypoint string
	// Dependency label for display.
	DepsLabel string
	// Repository URL for display.
	RepoLabel string
}

Result holds the results of app detection from a source directory.

func App

func App(dir string, pinFlag bool) (*Result, []string)

App inspects the source directory and determines the input case, app mode, and entrypoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL