You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ui.go
    path of file: ./repos/cockroach/pkg/cmd/dev
    
    the code of the file until where you have to start completion: // Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package main

import (
	"errors"
	"fmt"
	"log"
	"net/url"
	"os"
	"os/signal"
	"path/filepath"
	"strings"

	"github.com/spf13/cobra"
)

const (
	// ossFlag is the name of the boolean long (GNU-style) flag that builds only
	// the open-source parts of the UI.
	ossFlag = "oss"
)

// makeUICmd initializes the top-level 'ui' subcommand.
func makeUICmd(d *dev) *cobra.Command {
	uiCmd := &cobra.Command{
		Use:   "ui",
		Short: "Runs UI-related tasks",
		Long:  "Builds UI & runs UI-related commands to ease development flows",
	}

	uiCmd.AddCommand(makeUICleanCmd(d))
	uiCmd.AddCommand(makeUILintCmd(d))
	uiCmd.AddCommand(makeUITestCmd(d))
	uiCmd.AddCommand(makeUIWatchCmd(d))
	uiCmd.AddCommand(makeUIE2eCmd(d))
	uiCmd.AddCommand(makeMirrorDepsCmd(d))
	uiCmd.AddCommand(makeUIStorybookCmd(d))

	return uiCmd
}

// UIDirectories contains 
    
func arrangeFilesForWatchers(d *dev, ossOnly bool) error {
	bazelBin, err := d.getBazelBin(d.cli.Context(), []string{})
	if err != nil {
		return err
	}

	dbConsoleSrc := filepath.Join(bazelBin, "pkg", "ui", "workspaces", "db-console")
	dbConsoleCclSrc := filepath.Join(dbConsoleSrc, "ccl")

	dstDirs, err := getUIDirs(d)
	if err != nil {
		return err
	}
	dbConsoleDst := dstDirs.dbConsole
	dbConsoleCclDst := filepath.Join(dbConsoleDst, "ccl")

	protoFiles := []string{
		filepath.Join("src", "js", "protos.js"),
		filepath.Join("src", "js", "protos.d.ts"),
	}

	// Recreate protobuf client files that were previously copied out of the sandbox
	for _, relPath := range protoFiles {
		ossDst := filepath.Join(dbConsoleDst, relPath)
		if err := d.os.CopyFile(filepath.Join(dbConsoleSrc, relPath), ossDst); err != nil {
			return err
		}

		if ossOnly {
			continue
		}

		cclDst := filepath.Join(dbConsoleCclDst, relPath)
		if err := d.os.CopyFile(filepath.Join(dbConsoleCclSrc, relPath), cclDst); err != nil {
			return err
		}
	}

	// Delete cluster-ui output tree that was previously copied out of the sandbox
	err = d.os.RemoveAll(filepath.Join(dstDirs.clusterUI, "dist"))
	if err != nil {
		return err
	}

	// Copy the cluster-ui output tree back out of the sandbox
	err = d.os.CopyAll(
		filepath.Join(bazelBin, "pkg", "ui", "workspaces", "cluster-ui", "dist"),
		filepath.Join(dstDirs.clusterUI, "dist"),
	)
	if err != nil {
		return err
	}

	return nil
}