From dc70bc8ac76320600850cd28eb2170698e64a6a0 Mon Sep 17 00:00:00 2001 From: zhijian Date: Mon, 6 Mar 2023 15:29:40 +0800 Subject: [PATCH] fix windows build --- cmd/{clone.go => clone_linux.go} | 14 +++++++++++-- cmd/clone_unix.go | 35 -------------------------------- cmd/clone_windows.go | 10 ++++----- 3 files changed, 17 insertions(+), 42 deletions(-) rename cmd/{clone.go => clone_linux.go} (89%) delete mode 100644 cmd/clone_unix.go diff --git a/cmd/clone.go b/cmd/clone_linux.go similarity index 89% rename from cmd/clone.go rename to cmd/clone_linux.go index 07a38ec811e8..b25121568fc6 100644 --- a/cmd/clone.go +++ b/cmd/clone_linux.go @@ -26,13 +26,23 @@ import ( "github.com/juicedata/juicefs/pkg/meta" "github.com/juicedata/juicefs/pkg/utils" - "github.com/urfave/cli/v2" ) func cmdClone() *cli.Command { - return cmdCloneFunc() + return &cli.Command{ + Name: "clone", + Action: clone, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "cp", + Usage: "create files with current uid,gid,umask (like 'cp')"}, + }, + Category: "TOOL", + Description: `This command can clone a file or directory without copying the underlying data.`, + } } + func clone(ctx *cli.Context) error { setup(ctx, 2) if runtime.GOOS == "windows" { diff --git a/cmd/clone_unix.go b/cmd/clone_unix.go deleted file mode 100644 index 099337aaa608..000000000000 --- a/cmd/clone_unix.go +++ /dev/null @@ -1,35 +0,0 @@ -/* - * JuiceFS, Copyright 2023 Juicedata, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package cmd - -import ( - "github.com/urfave/cli/v2" -) - -func cmdCloneFunc() *cli.Command { - return &cli.Command{ - Name: "clone", - Action: clone, - Flags: []cli.Flag{ - &cli.BoolFlag{ - Name: "cp", - Usage: "create files with current uid,gid,umask (like 'cp')"}, - }, - Category: "TOOL", - Description: `This command can clone a file or directory without copying the underlying data.`, - } -} diff --git a/cmd/clone_windows.go b/cmd/clone_windows.go index 145a6b59096c..0b44bb084525 100644 --- a/cmd/clone_windows.go +++ b/cmd/clone_windows.go @@ -17,18 +17,18 @@ package cmd import ( - "errors" + "fmt" "github.com/urfave/cli/v2" ) -func cmdCloneFunc() *cli.Command { +func cmdClone() *cli.Command { return &cli.Command{ Name: "clone", Category: "TOOL", - Description: `This feature is not supported on Windows.`, - Action: func(*cli.Context) error { - return errors.New("not supported") + Description: `This command is not supported on windows.`, + Action: func(context *cli.Context) error { + return fmt.Errorf("this command is not supported on windows") }, } }