Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional path parameter #8

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions cmd/dockerfuse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
var (
containerID string
mountPoint string
path string
daemonize bool
printVersion bool
// Version holds the version tag, and it is set at build-time
Expand All @@ -39,11 +40,14 @@ func init() {
flag.BoolVar(&printVersion, "version", false, "Print the version and exit")
flag.BoolVar(&printVersion, "v", false, "Print the version and exit")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦🏼‍♂️

flag.StringVar(&containerID, "id", "", "Docker containter ID (or name)")
flag.StringVar(&containerID, "i", "", "Docker containter ID (or name)")
flag.StringVar(&containerID, "id", "", "Docker container ID (or name)")
flag.StringVar(&containerID, "i", "", "Docker container ID (or name)")

flag.StringVar(&mountPoint, "mount", "", "Mount point for containter FS")
flag.StringVar(&mountPoint, "m", "", "Mount point for containter FS")
flag.StringVar(&mountPoint, "mount", "", "Mount point for container FS")
flag.StringVar(&mountPoint, "m", "", "Mount point for container FS")

flag.StringVar(&path, "path", "/", "Path inside the container")
flag.StringVar(&path, "p", "/", "Path inside the container")

flag.BoolVar(&daemonize, "daemonize", false, "Daemonize fuse process")
flag.BoolVar(&daemonize, "d", false, "Daemonize fuse process")
Expand All @@ -53,7 +57,7 @@ func init() {
func main() {
flag.Parse()
if printVersion {
fmt.Printf("DockerFuse\nVersion: %s\nGit commmit: %s\n", Version, GitCommit)
fmt.Printf("DockerFuse\nVersion: %s\nGit commit: %s\n", Version, GitCommit)
os.Exit(0)
}

Expand Down Expand Up @@ -101,15 +105,15 @@ func main() {

fuseDockerClient, err := client.NewDockerFuseClient(containerID)
if err != nil {
log.Panicf("error initiazializing docker client: %s", err)
log.Panicf("error initializing docker client: %s", err)
} else {
log.Printf("docker client created")
}

log.Printf("mounting FS to %v...", mountPoint)
vEntryTTL := entryTTL
vAttrTTL := attrTTL
server, err := fs.Mount(mountPoint, client.NewNode(fuseDockerClient, "/", ""), &fs.Options{
server, err := fs.Mount(mountPoint, client.NewNode(fuseDockerClient, path, ""), &fs.Options{
EntryTimeout: &vEntryTTL,
AttrTimeout: &vAttrTTL,
NegativeTimeout: &vEntryTTL,
Expand Down
Loading