Exemple #1
0
func New(context *config.Context, opts *Options) *Commands {
	var r *Remote
	if context != nil {
		r = NewRemoteContext(context)
	}

	stdin, stdout, stderr := os.Stdin, os.Stdout, os.Stderr

	var logger *log.Logger = nil

	if opts == nil {
		logger = log.New(stdin, stdout, stderr)
	} else {
		if opts.Quiet {
			stdout = nil
		}

		if stdout != nil {
			opts.StdoutIsTty = isatty.IsTerminal(stdout.Fd())
		}

		if stdout == nil && opts.Piped {
			panic("piped requires stdout to be non-nil")
		}

		logger = log.New(stdin, stdout, stderr)

		// should always start with /
		opts.Path = path.Clean(path.Join("/", opts.Path))

		if !opts.Force {
			ignoresPath := filepath.Join(context.AbsPath, DriveIgnoreSuffix)
			ignorer, regErr := combineIgnores(ignoresPath)

			if regErr != nil {
				logger.LogErrf("combining ignores from path %s and internally: %v\n", ignoresPath, regErr)
			}

			opts.Ignorer = ignorer
		}
	}

	return &Commands{
		context:       context,
		rem:           r,
		opts:          opts,
		log:           logger,
		mkdirAllCache: expirableCache.New(),
	}
}
Exemple #2
0
func New(context *config.Context, opts *Options) *Commands {
	var r *Remote
	if context != nil {
		r = NewRemoteContext(context)
	}

	stdin, stdout, stderr := os.Stdin, os.Stdout, os.Stderr

	logger := log.New(stdin, stdout, stderr)

	if opts != nil {
		// should always start with /
		opts.Path = path.Clean(path.Join("/", opts.Path))

		if !opts.Force {
			ignoresPath := filepath.Join(context.AbsPath, DriveIgnoreSuffix)
			ignoreRegexp, regErr := combineIgnores(ignoresPath)

			if regErr != nil {
				logger.LogErrf("combining ignores from path %s and internally: %v\n", ignoresPath, regErr)
			}

			opts.IgnoreRegexp = ignoreRegexp
		}

		opts.StdoutIsTty = isatty.IsTerminal(stdout.Fd())

		if opts.Quiet {
			stdout = nil
		}
	}

	return &Commands{
		context:       context,
		rem:           r,
		opts:          opts,
		log:           logger,
		mkdirAllCache: expirableCache.New(),
	}
}
Exemple #3
0
func main() {
	logy := log.New()
}
Exemple #4
0
)

type mapper struct {
	allof7e []char
	gpio    []char
}

var (
	PageSize  = syscall.Getpagesize()
	BlockSize = PageSize

	protMmapRW = syscall.PROT_READ | syscall.PROT_WRITE
)

var (
	logger = log.New(os.Stdin, os.Stdout, os.Stderr)
)

const (
	MmapBase = 0x20000000
	MmapLen  = 0x01000000
)

var (
	BASE_START = 0x7E000000
	CLKBASE    = 0x7E001000
	DMABASE    = 0x7E007000
	CM_GP0CTL  = 0x7E101070
	CM_GP0DIV  = 0x7E101074
	GPFSEL0    = 0x7E200000
	PWMBASE    = 0x7E20C000