code: func (pget *Pget) Ready() error {
  	if procs := os.Getenv("GOMAXPROCS"); procs == "" {
  		runtime.GOMAXPROCS(pget.Procs)
  	}
  
  	var opts Options
  	if err := pget.parseOptions(&opts, os.Args[1:]); err != nil {
  		return errors.Wrap(err, "failed to parse command line args")
  	}
  
  	if opts.Trace {
  		pget.Trace = opts.Trace
  	}
  
  	if opts.Procs > 2 {
  		pget.Procs = opts.Procs
  	}
  
  	if opts.Timeout > 0 {
  		pget.timeout = opts.Timeout
  	}
  
  	if err := pget.parseURLs(); err != nil {
  		return errors.Wrap(err, "failed to parse of url")
  	}
  
  	if opts.Output != "" {
  		pget.Utils.SetFileName(opts.Output)
  	}
  
  	if opts.UserAgent != "" {
  		pget.useragent = opts.UserAgent
  	}
  
  	if opts.Referer != "" {
  		pget.referer = opts.Referer
  	}
  
  	if opts.TargetDir != "" {
  		info, err := os.Stat(opts.TargetDir)
  		if err != nil {
  			if !os.IsNotExist(err) {
  				return errors.Wrap(err, "target dir is invalid")
  			}
  
  			if err := os.MkdirAll(opts.TargetDir, 0755); err != nil {
  				return errors.Wrapf(err, "failed to create diretory at %s", opts.TargetDir)
  			}
  
  		} else if !info.IsDir() {
  			return errors.New("target dir is not a valid directory")
  		}
  		opts.TargetDir = strings.TrimSuffix(opts.TargetDir, "/")
  	}
  	pget.TargetDir = opts.TargetDir
  
  	return nil
  }
docs: // Ready method define the variables required to Download.